crypto: ccp - fix resource leaks in ccp_run_aes_gcm_cmd()
mainline inclusion from mainline-5.15-rc4 commit 505d9dcb bugzilla: 182864 https://gitee.com/openeuler/kernel/issues/I4DDEL CVE: CVE-2021-3744 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=505d9dcb0f7ddf9d075e729523a33d38642ae680 -------------------------------- There are three bugs in this code: 1) If we ccp_init_data() fails for &src then we need to free aad. Use goto e_aad instead of goto e_ctx. 2) The label to free the &final_wa was named incorrectly as "e_tag" but it should have been "e_final_wa". One error path leaked &final_wa. 3) The &tag was leaked on one error path. In that case, I added a free before the goto because the resource was local to that block. Fixes: 36cf515b ("crypto: ccp - Enable support for AES GCM on v5 CCPs") Reported-by: N"minihanshen(沈明航)" <minihanshen@tencent.com> Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com> Reviewed-by: NJohn Allen <john.allen@amd.com> Tested-by: NJohn Allen <john.allen@amd.com> Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au> Signed-off-by: NChen Jun <chenjun102@huawei.com> Reviewed-by: NXiu Jianfeng <xiujianfeng@huawei.com> Signed-off-by: NChen Jun <chenjun102@huawei.com> Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Showing
想要评论请 注册 或 登录