summaryrefslogtreecommitdiff
path: root/kernel/workqueue.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-03-10 23:48:14 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2019-03-10 23:48:14 +0300
commit9e55f87c0e3b3db11f52834222f881094eb97205 (patch)
treede9316b8a61915c169eb193e266f2ba7010efe19 /kernel/workqueue.c
parent077d3dafe63cb26653f2b171fa102dbefd242fa8 (diff)
parent69a106c00e8554a7e6b3f4bb2967332670f89337 (diff)
downloadlinux-9e55f87c0e3b3db11f52834222f881094eb97205.tar.xz
Merge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull locking fixes from Thomas Gleixner: "A few fixes for lockdep: - initialize lockdep internal RCU head after initializing RCU - prevent use after free in a alloc_workqueue() error handling path - plug a memory leak in the workqueue core which fails to free a dynamically allocated lock name. - make Clang happy" * 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: workqueue, lockdep: Fix a memory leak in wq->lock_name workqueue, lockdep: Fix an alloc_workqueue() error path locking/lockdep: Only call init_rcu_head() after RCU has been initialized locking/lockdep: Avoid a Clang warning
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r--kernel/workqueue.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 7abbeed13421..4026d1871407 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -3445,6 +3445,8 @@ static void wq_init_lockdep(struct workqueue_struct *wq)
lock_name = kasprintf(GFP_KERNEL, "%s%s", "(wq_completion)", wq->name);
if (!lock_name)
lock_name = wq->name;
+
+ wq->lock_name = lock_name;
lockdep_init_map(&wq->lockdep_map, lock_name, &wq->key, 0);
}
@@ -4291,6 +4293,8 @@ struct workqueue_struct *alloc_workqueue(const char *fmt,
return wq;
err_free_wq:
+ wq_unregister_lockdep(wq);
+ wq_free_lockdep(wq);
free_workqueue_attrs(wq->unbound_attrs);
kfree(wq);
return NULL;