Linux kernel -stable discussions
 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>,
	Wolfgang Walter <linux@stwm.de>,
	Eric Biggers <ebiggers@kernel.org>
Subject: [PATCH 5.10 08/10] crypto: authencesn - Fix src offset when decrypting in-place
Date: Thu, 30 Apr 2026 00:01:26 -0700	[thread overview]
Message-ID: <20260430070128.219863-9-ebiggers@kernel.org> (raw)
In-Reply-To: <20260430070128.219863-1-ebiggers@kernel.org>

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

commit 1f48ad3b19a9dfc947868edda0bb8e48e5b5a8fa upstream.

The src SG list offset wasn't set properly when decrypting in-place,
fix it.

Reported-by: Wolfgang Walter <linux@stwm.de>
Fixes: e02494114ebf ("crypto: authencesn - Do not place hiseq at end of dst for out-of-place decryption")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
 crypto/authencesn.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/crypto/authencesn.c b/crypto/authencesn.c
index 5dc057cb0cdf..2154d4ab5c95 100644
--- a/crypto/authencesn.c
+++ b/crypto/authencesn.c
@@ -233,13 +233,15 @@ static int crypto_authenc_esn_decrypt_tail(struct aead_request *req,
 	if (crypto_memneq(ihash, ohash, authsize))
 		return -EBADMSG;
 
 decrypt:
 
-	if (src != dst)
-		src = scatterwalk_ffwd(areq_ctx->src, src, assoclen);
 	dst = scatterwalk_ffwd(areq_ctx->dst, dst, assoclen);
+	if (req->src == req->dst)
+		src = dst;
+	else
+		src = scatterwalk_ffwd(areq_ctx->src, src, assoclen);
 
 	skcipher_request_set_tfm(skreq, ctx->enc);
 	skcipher_request_set_callback(skreq, flags,
 				      req->base.complete, req->base.data);
 	skcipher_request_set_crypt(skreq, src, dst, cryptlen, req->iv);
-- 
2.54.0


  parent reply	other threads:[~2026-04-30  7:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-30  7:01 [PATCH 5.10 00/10] AF_ALG fixes Eric Biggers
2026-04-30  7:01 ` [PATCH 5.10 01/10] crypto: doc - fix kernel-doc notation in chacha.c and af_alg.c Eric Biggers
2026-04-30  7:01 ` [PATCH 5.10 02/10] crypto: scatterwalk - Backport memcpy_sglist() Eric Biggers
2026-04-30  7:01 ` [PATCH 5.10 03/10] crypto: algif_aead - use memcpy_sglist() instead of null skcipher Eric Biggers
2026-04-30  7:01 ` [PATCH 5.10 04/10] crypto: algif_aead - Revert to operating out-of-place Eric Biggers
2026-04-30  7:01 ` [PATCH 5.10 05/10] crypto: algif_aead - snapshot IV for async AEAD requests Eric Biggers
2026-04-30  7:01 ` [PATCH 5.10 06/10] crypto: authenc - use memcpy_sglist() instead of null skcipher Eric Biggers
2026-04-30  7:01 ` [PATCH 5.10 07/10] crypto: authencesn - Do not place hiseq at end of dst for out-of-place decryption Eric Biggers
2026-04-30  7:01 ` Eric Biggers [this message]
2026-04-30  7:01 ` [PATCH 5.10 09/10] crypto: af_alg - Fix page reassignment overflow in af_alg_pull_tsgl Eric Biggers
2026-04-30  7:01 ` [PATCH 5.10 10/10] crypto: algif_aead - Fix minimum RX size check for decryption Eric Biggers

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=20260430070128.219863-9-ebiggers@kernel.org \
    --to=ebiggers@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux@stwm.de \
    --cc=stable@vger.kernel.org \
    /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