Skip to content

Commit b2df03e

Browse files
ivpravdinherbertx
authored andcommitted
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: fe869cd ("crypto: algif_hash - User-space interface for hash operations") Cc: <[email protected]> Signed-off-by: Ivan Pravdin <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent d6ebcde commit b2df03e

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

crypto/algif_hash.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,6 @@ static int hash_accept(struct socket *sock, struct socket *newsock,
265265
goto out_free_state;
266266

267267
err = crypto_ahash_import(&ctx2->req, state);
268-
if (err) {
269-
sock_orphan(sk2);
270-
sock_put(sk2);
271-
}
272268

273269
out_free_state:
274270
kfree_sensitive(state);

0 commit comments

Comments
 (0)