Re: [PATCH v3] workqueue: Fix UAF report by KASAN in pwq_release_workfn()

From: Tejun Heo
Date: Wed Oct 04 2023 - 15:16:01 EST


On Wed, Sep 20, 2023 at 02:07:04PM +0800, Zqiang wrote:
> Currently, for UNBOUND wq, if the apply_wqattrs_prepare() return error,
> the apply_wqattr_cleanup() will be called and use the pwq_release_worker
> kthread to release resources asynchronously. however, the kfree(wq) is
> invoked directly in failure path of alloc_workqueue(), if the kfree(wq)
> has been executed and when the pwq_release_workfn() accesses wq, this
> leads to the following scenario:

Applied to cgroup/for-6.6-fixes.

Thanks.

--
tejun