From: Yu'an Wang wangyuan46@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
In this patch, we try to fixup the problem of wrong judgement of used parameter. When the accelerator driver registers to crypto, the self-test program will send task to hardware, the used para will decrease in interrupt thread, but exit flow of crypto will call hisi_qm_stop_qp_nolock function to stop queue, which try to get value of used. In the above scene, it will appear to get the value first and then decrease, which causes null pointer. So we should distinguish fault handling process from normal stop process.
Signed-off-by: Yu'an Wang wangyuan46@huawei.com Reviewed-by: Cheng Hu hucheng.hu@huawei.com Reviewed-by: Guangwei Zhou zhouguangwei5@huawei.com Reviewed-by: Junxian Liu liujunxian3@huawei.com Reviewed-by: Shukun Tan tanshukun1@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/crypto/hisilicon/qm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index e89a770..86f4a12 100644 --- a/drivers/crypto/hisilicon/qm.c +++ b/drivers/crypto/hisilicon/qm.c @@ -1591,10 +1591,12 @@ static int hisi_qm_stop_qp_nolock(struct hisi_qp *qp)
if (qp->qm->wq) flush_workqueue(qp->qm->wq); + else + flush_work(&qp->qm->work);
/* wait for increase used count in qp send and last poll qp finish */ udelay(WAIT_PERIOD); - if (atomic_read(&qp->qp_status.used)) + if (unlikely(qp->is_resetting && atomic_read(&qp->qp_status.used))) qp_stop_fail_cb(qp);
dev_dbg(dev, "stop queue %u!", qp->qp_id);