From: Herbert Xu <herbert@gondor.apana.org.au>
To: Rosen Penev <rosenp@gmail.com>
Cc: linux-crypto@vger.kernel.org,
"Horia Geantă" <horia.geanta@nxp.com>,
"Pankaj Gupta" <pankaj.gupta@nxp.com>,
"Gaurav Jain" <gaurav.jain@nxp.com>,
"David S. Miller" <davem@davemloft.net>,
"open list" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] crypto: caam/jr: fix use-after-free in interrupt handler teardown
Date: Mon, 10 Aug 2026 18:10:25 +1000 [thread overview]
Message-ID: <anmHccSuAF5apZr2@gondor.apana.org.au> (raw)
In-Reply-To: <20260730231603.1169539-1-rosenp@gmail.com>
On Thu, Jul 30, 2026 at 04:16:03PM -0700, Rosen Penev wrote:
> caam_jr_shutdown() currently calls tasklet_kill() without freeing the
> IRQ first, creating a window where the interrupt handler can fire and
> schedule the tasklet after it has been killed. Move from
> devm_request_irq() to request_irq()/free_irq() so that the IRQ is
> explicitly freed in caam_jr_shutdown() before the tasklet is killed.
>
> As part of this change, pass jrp directly as the dev_id cookie to
> request_irq() instead of the device pointer. This lets the interrupt
> handler obtain jrp directly from the cookie, eliminating the
> dev_get_drvdata() call in the hot path.
>
> Two related fixes:
> - Use jrp->dev instead of the now-undefined dev local in the handler's
> error path.
> - Set jrpriv->dev before calling caam_jr_init() so that jrp->dev is
> valid before the IRQ is registered and the handler can run.
>
> Assisted-by: opencode:big-pickle
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
> drivers/crypto/caam/jr.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
I think we should fix the general problem of hardware removal
in the middle of a crypto operation first before attempting these
fixes.
The driver needs to be modified so that it can fail gracefully
if the hardware is forcefully unbound while a crypto op is ongoing.
Thanks,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
next prev parent reply other threads:[~2026-08-10 8:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 23:16 Rosen Penev
2026-08-10 8:10 ` Herbert Xu [this message]
2026-08-12 18:54 ` Rosen Penev
2026-08-13 1:09 ` 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=anmHccSuAF5apZr2@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=davem@davemloft.net \
--cc=gaurav.jain@nxp.com \
--cc=horia.geanta@nxp.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pankaj.gupta@nxp.com \
--cc=rosenp@gmail.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
all inboxes | Powered by JetHome®