Re: [PATCH v3] workqueue: fix UAF in pwq_unbound_release_workfn()

From: Tejun Heo
Date: Fri Jul 16 2021 - 12:14:56 EST


On Wed, Jul 14, 2021 at 05:19:33PM +0800, Yang Yingliang wrote:
> If apply_wqattrs_prepare() fails, the new pwq are not linked, it doesn't
> hold any reference to the 'wq', 'wq' is invalid to access in the worker,
> so add check pwq if linked to fix this.
>
> Fixes: 2d5f0764b526 ("workqueue: split apply_workqueue_attrs() into 3 stages")
> Reported-by: Hulk Robot <hulkci@xxxxxxxxxx>
> Suggested-by: Lai Jiangshan <jiangshanlai@xxxxxxxxx>
> Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx>

Applied to wq/for-5.14-fixes.

Thanks.

--
tejun