提交 aeb03295 编写于 作者: N Navid Emamdoost 提交者: Xie XiuQi

crypto: ccp - Release all allocated memory if sha type is invalid

mainline inclusion
from mainline-v5.5
commit 128c66429247add5128c03dc1e144ca56f05a4e2
category: bugfix
bugzilla: 13690
CVE: CVE-2019-18808

-------------------------------------------------

Release all allocated memory if sha type is invalid:
In ccp_run_sha_cmd, if the type of sha is invalid, the allocated
hmac_buf should be released.

v2: fix the goto.
Signed-off-by: NNavid Emamdoost <navid.emamdoost@gmail.com>
Acked-by: NGary R Hook <gary.hook@amd.com>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Reviewed-by: NJason Yan <yanaijie@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 710e87a3
...@@ -1793,8 +1793,9 @@ static int ccp_run_sha_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) ...@@ -1793,8 +1793,9 @@ static int ccp_run_sha_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd)
LSB_ITEM_SIZE); LSB_ITEM_SIZE);
break; break;
default: default:
kfree(hmac_buf);
ret = -EINVAL; ret = -EINVAL;
goto e_ctx; goto e_data;
} }
memset(&hmac_cmd, 0, sizeof(hmac_cmd)); memset(&hmac_cmd, 0, sizeof(hmac_cmd));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册