crypto: algif_hash - fix double free in hash_accept

JIRA: https://issues.redhat.com/browse/RHEL-102248
CVE: CVE-2025-38079

commit b2df03ed4052e97126267e8c13ad4204ea6ba9b6
Author: Ivan Pravdin <ipravdin.official@gmail.com>
Date:   Sun May 18 18:41:02 2025 -0400

    crypto: algif_hash - fix double free in hash_accept

    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: fe869cdb89 ("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>

Signed-off-by: CKI Backport Bot <cki-ci-bot+cki-gitlab-backport-bot@redhat.com>
This commit is contained in:
CKI Backport Bot 2025-07-08 05:07:21 +00:00
parent e67fe5a877
commit 0ec7461c76
1 changed files with 0 additions and 4 deletions

View File

@ -265,10 +265,6 @@ static int hash_accept(struct socket *sock, struct socket *newsock,
goto out_free_state;
err = crypto_ahash_import(&ctx2->req, state);
if (err) {
sock_orphan(sk2);
sock_put(sk2);
}
out_free_state:
kfree_sensitive(state);