summaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorIvan Pravdin2025-05-18 18:41:02 -0400
committerGreg Kroah-Hartman2025-06-04 14:40:20 +0200
commitf0f3d09f53534ea385d55ced408f2b67059b16e4 (patch)
tree75ac5340e449ba376db53637861d25a0a3e9ec9e /crypto
parent3cb003b959d7e5a1abaddf5434fb8a5a69b916a2 (diff)
crypto: algif_hash - fix double free in hash_accept
commit b2df03ed4052e97126267e8c13ad4204ea6ba9b6 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/algif_hash.c4
1 files changed, 0 insertions, 4 deletions
diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c
index 1d017ec5c63c..84f4e9c2b5d9 100644
--- a/crypto/algif_hash.c
+++ b/crypto/algif_hash.c
@@ -263,10 +263,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;
}