[PATCH openEuler-1.0-LTS] crypto: algif_hash - fix double free in hash_accept

From: Ivan Pravdin <ipravdin.official@gmail.com> mainline inclusion from mainline-v6.15 commit b2df03ed4052e97126267e8c13ad4204ea6ba9b6 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/ICGACQ CVE: CVE-2025-38079 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i... -------------------------------- If accept(2) is called on socket type algif_hash with MSG_MORE flag set and crypto_ahash_import fails, sk2 is freed. However, it is also freed in af_alg_release, leading to slab-use-after-free error. Fixes: fe869cdb89c9 ("crypto: algif_hash - User-space interface for hash operations") Cc: <stable@vger.kernel.org> Signed-off-by: Ivan Pravdin <ipravdin.official@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Conflicts: crypto/algif_hash.c [Context conflicts.] Signed-off-by: Gu Bowen <gubowen5@huawei.com> --- crypto/algif_hash.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c index bfcf595fd8f9..3547db4ac4b2 100644 --- a/crypto/algif_hash.c +++ b/crypto/algif_hash.c @@ -267,10 +267,6 @@ static int hash_accept(struct socket *sock, struct socket *newsock, int flags, return err; err = crypto_ahash_import(&ctx2->req, state); - if (err) { - sock_orphan(sk2); - sock_put(sk2); - } return err; } -- 2.25.1

反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/16907 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/MMV... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/16907 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/MMV...
participants (2)
-
Gu Bowen
-
patchwork bot