From: "Jérémy Jean" <jeremy.jean@oss.cyber.gouv.fr>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v2] crypto: essiv: fix use-after-free in AEAD path
Date: Thu, 15 Oct 2026 15:33:45 +0200 [thread overview]
Message-ID: <32b563fa512a97b653bd06bc9bfc0ce0@oss.cyber.gouv.fr> (raw)
In-Reply-To: <atDE7dqBGm63pkde@gondor.apana.org.au>
On 2026-10-15 14:19, Herbert Xu wrote:
> On Thu, Oct 15, 2026 at 12:17:43PM +0000, Jérémy Jean wrote:
>>
>> @@ -247,11 +248,12 @@ static int essiv_aead_crypt(struct aead_request
>> *req, bool enc)
>> essiv_aead_done, req);
>> aead_request_set_crypt(subreq, src, req->dst, req->cryptlen,
>> req->iv);
>>
>> + assoc = rctx->assoc;
>> err = enc ? crypto_aead_encrypt(subreq) :
>> crypto_aead_decrypt(subreq);
>>
>> - if (rctx->assoc && err != -EINPROGRESS && err != -EBUSY)
>> - kfree(rctx->assoc);
>> + if (err != -EINPROGRESS && err != -EBUSY)
>> + kfree(assoc);
>
> There is no need for assoc at all once the rctx->assoc test is
> dropped. If the condition is true then rctx cannot have been
> freed.
Indeed, you are totally right, this is definitely simpler, thanks.
Do you prefer I resend a v2 or send a v3?
diff --git a/crypto/essiv.c b/crypto/essiv.c
index a47a3eab6935..3505b2769d93 100644
--- a/crypto/essiv.c
+++ b/crypto/essiv.c
@@ -250,7 +250,7 @@ static int essiv_aead_crypt(struct aead_request
*req, bool enc)
err = enc ? crypto_aead_encrypt(subreq) :
crypto_aead_decrypt(subreq);
- if (rctx->assoc && err != -EINPROGRESS && err != -EBUSY)
- kfree(rctx->assoc);
+ if (err != -EINPROGRESS && err != -EBUSY)
+ kfree(rctx->assoc);
return err;
}
next prev parent reply other threads:[~2026-10-15 13:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 12:17 Jérémy Jean
2026-10-15 12:19 ` Herbert Xu
2026-10-15 13:33 ` Jérémy Jean [this message]
2026-10-15 23:35 ` Herbert Xu
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=32b563fa512a97b653bd06bc9bfc0ce0@oss.cyber.gouv.fr \
--to=jeremy.jean@oss.cyber.gouv.fr \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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
all inboxes | Powered by JetHome®