提交 c113eec0 编写于 作者: Y Yu'an Wang 提交者: Yang Yingliang

crypto: hisilicon-hpre add req check when callback

hulk inclusion
category: Bugfix
bugzilla: NA
CVE: NA

When running the hpre kernel state task, a ras error occurred.
After the driver actively called back the incomplete task to
recycle the sqe resources, the hardware wrote back the sqe and
caused the kernel calltrace.
Signed-off-by: NYu'an Wang <wangyuan46@huawei.com>
Signed-off-by: NHui Tang <tanghui20@huawei.com>
Reviewed-by: NZibo Xu <xuzaibo@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 4f389391
......@@ -32,6 +32,7 @@ enum hpre_dfx_dbgfs_file {
HPRE_SEND_BUSY_CNT,
HPRE_OVER_THRHLD_CNT,
HPRE_OVERTIME_THRHLD,
HPRE_INVALID_REQ_CNT,
HPRE_DFX_FILE_NUM
};
......
......@@ -414,9 +414,17 @@ static void hpre_rsa_cb(struct hpre_ctx *ctx, void *resp)
static void hpre_alg_cb(struct hisi_qp *qp, void *resp)
{
struct hpre_ctx *ctx = qp->qp_ctx;
struct hpre_dfx *dfx = ctx->hpre->debug.dfx;
struct hpre_sqe *sqe = resp;
struct hpre_asym_request *req = ctx->req_list[le16_to_cpu(sqe->tag)];
if (unlikely(!req)) {
atomic64_inc(&dfx[HPRE_INVALID_REQ_CNT].value);
return;
}
ctx->req_list[le16_to_cpu(sqe->tag)]->cb(ctx, resp);
req->cb(ctx, resp);
}
static int hpre_ctx_init(struct hpre_ctx *ctx)
......
......@@ -178,7 +178,8 @@ static const char *hpre_dfx_files[HPRE_DFX_FILE_NUM] = {
"send_fail_cnt",
"send_busy_cnt",
"over_thrhld_cnt",
"overtime_thrhld"
"overtime_thrhld",
"invalid_req_cnt"
};
#ifdef CONFIG_CRYPTO_QM_UACCE
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册