From: Tejun Heo <tj@kernel.org>
To: Lai Jiangshan <jiangshanlai@gmail.com>
Cc: linux-kernel@vger.kernel.org,
Lai Jiangshan <jiangshan.ljs@antgroup.com>,
cheung wall <zzqq0103.hey@gmail.com>
Subject: Re: [PATCH] workqueue: Put the pwq after detaching the rescuer from the pool
Date: Fri, 24 Jan 2025 09:30:24 -1000 [thread overview]
Message-ID: <Z5PqUHHnvjp5VXmZ@slm.duckdns.org> (raw)
In-Reply-To: <20250123082535.1538074-1-jiangshanlai@gmail.com>
On Thu, Jan 23, 2025 at 04:25:35PM +0800, Lai Jiangshan wrote:
> From: Lai Jiangshan <jiangshan.ljs@antgroup.com>
>
> The commit 68f83057b913("workqueue: Reap workers via kthread_stop() and
> remove detach_completion") adds code to reap the normal workers but
> mistakenly does not handle the rescuer and also removes the code waiting
> for the rescuer in put_unbound_pool(), which caused a use-after-free bug
> reported by Cheung Wall.
>
> To avoid the use-after-free bug, the pool’s reference must be held until
> the detachment is complete. Therefore, move the code that puts the pwq
> after detaching the rescuer from the pool.
>
> Reported-by: cheung wall <zzqq0103.hey@gmail.com>
> Cc: cheung wall <zzqq0103.hey@gmail.com>
> Link: https://lore.kernel.org/lkml/CAKHoSAvP3iQW+GwmKzWjEAOoPvzeWeoMO0Gz7Pp3_4kxt-RMoA@mail.gmail.com/
> Fixes: 68f83057b913("workqueue: Reap workers via kthread_stop() and remove detach_completion")
> Signed-off-by: Lai Jiangshan <jiangshan.ljs@antgroup.com>
Applied to wq/for-6.14-fixes.
Thanks.
--
tejun
prev parent reply other threads:[~2025-01-24 19:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-23 8:25 Lai Jiangshan
2025-01-24 19:30 ` Tejun Heo [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=Z5PqUHHnvjp5VXmZ@slm.duckdns.org \
--to=tj@kernel.org \
--cc=jiangshan.ljs@antgroup.com \
--cc=jiangshanlai@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=zzqq0103.hey@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®