We need to preserve error code before freeing "rescuer".
Fixes: f187b6974f6df ("workqueue: Use IS_ERR and PTR_ERR instead of PTR_ERR_OR_ZERO.")
Signed-off-by: Dan Carpenter <[email protected]>
Reviewed-by: Lai Jiangshan <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>
static int init_rescuer(struct workqueue_struct *wq)
{
struct worker *rescuer;
+ int ret;
if (!(wq->flags & WQ_MEM_RECLAIM))
return 0;
rescuer->rescue_wq = wq;
rescuer->task = kthread_create(rescuer_thread, rescuer, "%s", wq->name);
if (IS_ERR(rescuer->task)) {
+ ret = PTR_ERR(rescuer->task);
kfree(rescuer);
- return PTR_ERR(rescuer->task);
+ return ret;
}
wq->rescuer = rescuer;