mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-11-27 20:13:57 +08:00
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
This commit is contained in:
commit
9e55f87c0e
@ -842,7 +842,9 @@ static bool class_lock_list_valid(struct lock_class *c, struct list_head *h)
|
||||
return true;
|
||||
}
|
||||
|
||||
static u16 chain_hlocks[];
|
||||
#ifdef CONFIG_PROVE_LOCKING
|
||||
static u16 chain_hlocks[MAX_LOCKDEP_CHAIN_HLOCKS];
|
||||
#endif
|
||||
|
||||
static bool check_lock_chain_key(struct lock_chain *chain)
|
||||
{
|
||||
@ -980,15 +982,22 @@ static inline void check_data_structures(void) { }
|
||||
*/
|
||||
static void init_data_structures_once(void)
|
||||
{
|
||||
static bool initialization_happened;
|
||||
static bool ds_initialized, rcu_head_initialized;
|
||||
int i;
|
||||
|
||||
if (likely(initialization_happened))
|
||||
if (likely(rcu_head_initialized))
|
||||
return;
|
||||
|
||||
initialization_happened = true;
|
||||
if (system_state >= SYSTEM_SCHEDULING) {
|
||||
init_rcu_head(&delayed_free.rcu_head);
|
||||
rcu_head_initialized = true;
|
||||
}
|
||||
|
||||
if (ds_initialized)
|
||||
return;
|
||||
|
||||
ds_initialized = true;
|
||||
|
||||
init_rcu_head(&delayed_free.rcu_head);
|
||||
INIT_LIST_HEAD(&delayed_free.pf[0].zapped);
|
||||
INIT_LIST_HEAD(&delayed_free.pf[1].zapped);
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user