From: Herbert Xu <herbert@gondor.apana.org.au>
To: Aishwarya <aishwarya.tcv@arm.com>
Cc: dominik.grzegorzek@oracle.com, chenridong@huawei.com,
daniel.m.jordan@oracle.com, linux-crypto@vger.kernel.org,
linux-kernel@vger.kernel.org, steffen.klassert@secunet.com,
broonie@kernel.org
Subject: Re: [PATCH] padata: do not leak refcount in reorder_work
Date: Fri, 23 May 2025 11:48:41 +0800 [thread overview]
Message-ID: <aC_wGV_rc1JP06to@gondor.apana.org.au> (raw)
In-Reply-To: <20250522131041.8917-1-aishwarya.tcv@arm.com>
On Thu, May 22, 2025 at 02:10:41PM +0100, Aishwarya wrote:
>
> A bisect identified this patch as introducing the failure. Bisected
> it on the tag "v6.15-rc7-7-g4a95bc121ccd" at repo:
> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
What if you revert the patch in question as well as the one it
was supposed to fix, i.e., commit dd7d37ccf6b1 ("padata: avoid
UAF for reorder_work")? I've attached both reverts together as
a patch.
I think the original fix was broken since the bug is actually
in the Crypto API.
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
--
diff --git a/kernel/padata.c b/kernel/padata.c
index 7eee94166357..e0af15779d80 100644
--- a/kernel/padata.c
+++ b/kernel/padata.c
@@ -352,15 +352,8 @@ static void padata_reorder(struct parallel_data *pd)
smp_mb();
reorder = per_cpu_ptr(pd->reorder_list, pd->cpu);
- if (!list_empty(&reorder->list) && padata_find_next(pd, false)) {
- /*
- * Other context(eg. the padata_serial_worker) can finish the request.
- * To avoid UAF issue, add pd ref here, and put pd ref after reorder_work finish.
- */
- padata_get_pd(pd);
- if (!queue_work(pinst->serial_wq, &pd->reorder_work))
- padata_put_pd(pd);
- }
+ if (!list_empty(&reorder->list) && padata_find_next(pd, false))
+ queue_work(pinst->serial_wq, &pd->reorder_work);
}
static void invoke_padata_reorder(struct work_struct *work)
@@ -371,8 +364,6 @@ static void invoke_padata_reorder(struct work_struct *work)
pd = container_of(work, struct parallel_data, reorder_work);
padata_reorder(pd);
local_bh_enable();
- /* Pairs with putting the reorder_work in the serial_wq */
- padata_put_pd(pd);
}
static void padata_serial_worker(struct work_struct *serial_work)
prev parent reply other threads:[~2025-05-23 3:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-18 17:45 Dominik Grzegorzek
2025-05-19 1:39 ` Chen Ridong
2025-05-19 6:03 ` Herbert Xu
2025-05-20 16:00 ` Daniel Jordan
2025-05-22 13:10 ` Aishwarya
2025-05-22 13:44 ` Dominik Grzegorzek
2025-05-22 14:02 ` Mark Brown
2025-05-24 6:51 ` Herbert Xu
2025-05-23 3:48 ` Herbert Xu [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=aC_wGV_rc1JP06to@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=aishwarya.tcv@arm.com \
--cc=broonie@kernel.org \
--cc=chenridong@huawei.com \
--cc=daniel.m.jordan@oracle.com \
--cc=dominik.grzegorzek@oracle.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=steffen.klassert@secunet.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®