]> 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:13:45 +0000 (11:13 +0200)
commit9aee87da5572b3a14075f501752e209801160d3d
tree63d7fb89459116fb41a8ed3c70f0a8bf8fc5c920
parent1adc72411f3dc808fb9bc7385f8d566be4c173bb
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