]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
crypto: af_alg - Set merge to zero early in af_alg_sendmsg
authorHerbert Xu <herbert@gondor.apana.org.au>
Tue, 16 Sep 2025 07:42:41 +0000 (15:42 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Sep 2025 08:58:54 +0000 (10:58 +0200)
commit6241b9e2809b12da9130894cf5beddf088dc1b8a
treea3a8094bf8c7071091edcbafa028227406a6416a
parent56566873dadf7c30ec907e3ac17286b0d99f30a7
crypto: af_alg - Set merge to zero early in af_alg_sendmsg

[ Upstream commit 9574b2330dbd2b5459b74d3b5e9619d39299fc6f ]

If an error causes af_alg_sendmsg to abort, ctx->merge may contain
a garbage value from the previous loop.  This may then trigger a
crash on the next entry into af_alg_sendmsg when it attempts to do
a merge that can't be done.

Fix this by setting ctx->merge to zero near the start of the loop.

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>
crypto/af_alg.c