提交 20b95a87 编写于 作者: G GUO Zihua 提交者: Zheng Zengkai

pgp: Check result of crypto_alloc_shash properly

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5Z7MD
CVE: NA

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

Return of crypto_alloc_shash would be either a valid pointer or an error
pointer. We should check the result with IS_ERR.
Signed-off-by: NGUO Zihua <guozihua@huawei.com>
Reviewed-by: NXiu Jianfeng <xiujianfeng@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 28f690f1
......@@ -131,7 +131,7 @@ static int pgp_generate_fingerprint(struct pgp_key_data_parse_context *ctx,
ret = -ENOMEM;
tfm = crypto_alloc_shash(pgp->version < PGP_KEY_VERSION_4 ?
"md5" : "sha1", 0, 0);
if (!tfm)
if (IS_ERR(tfm))
goto cleanup;
digest = kmalloc(sizeof(*digest) + crypto_shash_descsize(tfm),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册