apply_workqueue_attrs() wasn't freeing temp attrs variable @new_attrs
in its success path. Fix it.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Lai Jiangshan <laijs@cn.fujitsu.com>
struct workqueue_attrs *new_attrs;
struct pool_workqueue *pwq = NULL, *last_pwq;
struct worker_pool *pool;
+ int ret;
/* only unbound workqueues can change attributes */
if (WARN_ON(!(wq->flags & WQ_UNBOUND)))
spin_unlock_irq(&last_pwq->pool->lock);
}
- return 0;
+ ret = 0;
+ /* fall through */
+out_free:
+ free_workqueue_attrs(new_attrs);
+ return ret;
enomem:
kmem_cache_free(pwq_cache, pwq);
- free_workqueue_attrs(new_attrs);
- return -ENOMEM;
+ ret = -ENOMEM;
+ goto out_free;
}
static int alloc_and_link_pwqs(struct workqueue_struct *wq)