Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: stable@vger.kernel.org
Cc: linux-crypto@vger.kernel.org,
	Herbert Xu <herbert@gondor.apana.org.au>,
	syzbot+aa11561819dc42ebbc7c@syzkaller.appspotmail.com,
	Daniel Pouzzner <douzzer@mega.nu>,
	Eric Biggers <ebiggers@kernel.org>
Subject: [PATCH 5.15 9/9] crypto: algif_aead - Fix minimum RX size check for decryption
Date: Wed, 29 Apr 2026 23:36:04 -0700	[thread overview]
Message-ID: <20260430063604.173525-10-ebiggers@kernel.org> (raw)
In-Reply-To: <20260430063604.173525-1-ebiggers@kernel.org>

From: Herbert Xu <herbert@gondor.apana.org.au>

commit 3d14bd48e3a77091cbce637a12c2ae31b4a1687c upstream.

The check for the minimum receive buffer size did not take the
tag size into account during decryption.  Fix this by adding the
required extra length.

Reported-by: syzbot+aa11561819dc42ebbc7c@syzkaller.appspotmail.com
Reported-by: Daniel Pouzzner <douzzer@mega.nu>
Fixes: d887c52d6ae4 ("crypto: algif_aead - overhaul memory management")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
 crypto/algif_aead.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crypto/algif_aead.c b/crypto/algif_aead.c
index 24e77f4968a6..4a285994d106 100644
--- a/crypto/algif_aead.c
+++ b/crypto/algif_aead.c
@@ -148,11 +148,11 @@ static int _aead_recvmsg(struct socket *sock, struct msghdr *msg,
 	 * of the input data.
 	 */
 	if (usedpages < outlen) {
 		size_t less = outlen - usedpages;
 
-		if (used < less) {
+		if (used < less + (ctx->enc ? 0 : as)) {
 			err = -EINVAL;
 			goto free;
 		}
 		used -= less;
 		outlen -= less;
-- 
2.54.0


      parent reply	other threads:[~2026-04-30  6:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-30  6:35 [PATCH 5.15 0/9] AF_ALG fixes Eric Biggers
2026-04-30  6:35 ` [PATCH 5.15 1/9] crypto: scatterwalk - Backport memcpy_sglist() Eric Biggers
2026-04-30  6:35 ` [PATCH 5.15 2/9] crypto: algif_aead - use memcpy_sglist() instead of null skcipher Eric Biggers
2026-04-30  6:35 ` [PATCH 5.15 3/9] crypto: algif_aead - Revert to operating out-of-place Eric Biggers
2026-04-30  6:35 ` [PATCH 5.15 4/9] crypto: algif_aead - snapshot IV for async AEAD requests Eric Biggers
2026-04-30  6:36 ` [PATCH 5.15 5/9] crypto: authenc - use memcpy_sglist() instead of null skcipher Eric Biggers
2026-04-30  6:36 ` [PATCH 5.15 6/9] crypto: authencesn - Do not place hiseq at end of dst for out-of-place decryption Eric Biggers
2026-04-30  6:36 ` [PATCH 5.15 7/9] crypto: authencesn - Fix src offset when decrypting in-place Eric Biggers
2026-04-30  6:36 ` [PATCH 5.15 8/9] crypto: af_alg - Fix page reassignment overflow in af_alg_pull_tsgl Eric Biggers
2026-04-30  6:36 ` Eric Biggers [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260430063604.173525-10-ebiggers@kernel.org \
    --to=ebiggers@kernel.org \
    --cc=douzzer@mega.nu \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=syzbot+aa11561819dc42ebbc7c@syzkaller.appspotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox