]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
crypto: af_alg - Disallow concurrent writes in af_alg_sendmsg
authorHerbert Xu <herbert@gondor.apana.org.au>
Tue, 16 Sep 2025 09:20:59 +0000 (17:20 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Sep 2025 09:16:45 +0000 (11:16 +0200)
commit45bcf60fe49b37daab1acee57b27211ad1574042
tree44ad15f616ec1daee1bf0b8405265c6d3e366815
parent7b7361da9e7f406ad37484c5d5cd33cb8303593a
crypto: af_alg - Disallow concurrent writes in af_alg_sendmsg

commit 1b34cbbf4f011a121ef7b2d7d6e6920a036d5285 upstream.

Issuing two writes to the same af_alg socket is bogus as the
data will be interleaved in an unpredictable fashion.  Furthermore,
concurrent writes may create inconsistencies in the internal
socket state.

Disallow this by adding a new ctx->write field that indiciates
exclusive ownership for writing.

Fixes: 8ff590903d5 ("crypto: algif_skcipher - User-space interface for skcipher operations")
Reported-by: Muhammad Alifa Ramdhan <ramdhan@starlabs.sg>
Reported-by: Bing-Jhong Billy Jheng <billy@starlabs.sg>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
crypto/af_alg.c
include/crypto/if_alg.h