]> 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>
Mon, 22 Sep 2025 18:44:49 +0000 (14:44 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Sep 2025 08:58:55 +0000 (10:58 +0200)
commit1f323a48e9b5ebfe6dc7d130fdf5c3c0e92a07c8
treee16fa286c007505ef0e5693bd19997002f9e4501
parent2b8bbc64b5c228cebd52bd03470d70ba781d1915
crypto: af_alg - Disallow concurrent writes in af_alg_sendmsg

[ Upstream commit 1b34cbbf4f011a121ef7b2d7d6e6920a036d5285 ]

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: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
crypto/af_alg.c
include/crypto/if_alg.h