Commit 26e2b819 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull locking fix from Ingo Molnar:
 "Fixes a crash when accessing /proc/lockdep"

* 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  locking/lockdep: Zap lock classes even with lock debugging disabled
parents 6a022984 90c1cba2
...@@ -4689,8 +4689,8 @@ static void free_zapped_rcu(struct rcu_head *ch) ...@@ -4689,8 +4689,8 @@ static void free_zapped_rcu(struct rcu_head *ch)
return; return;
raw_local_irq_save(flags); raw_local_irq_save(flags);
if (!graph_lock()) arch_spin_lock(&lockdep_lock);
goto out_irq; current->lockdep_recursion = 1;
/* closed head */ /* closed head */
pf = delayed_free.pf + (delayed_free.index ^ 1); pf = delayed_free.pf + (delayed_free.index ^ 1);
...@@ -4702,8 +4702,8 @@ static void free_zapped_rcu(struct rcu_head *ch) ...@@ -4702,8 +4702,8 @@ static void free_zapped_rcu(struct rcu_head *ch)
*/ */
call_rcu_zapped(delayed_free.pf + delayed_free.index); call_rcu_zapped(delayed_free.pf + delayed_free.index);
graph_unlock(); current->lockdep_recursion = 0;
out_irq: arch_spin_unlock(&lockdep_lock);
raw_local_irq_restore(flags); raw_local_irq_restore(flags);
} }
...@@ -4744,21 +4744,17 @@ static void lockdep_free_key_range_reg(void *start, unsigned long size) ...@@ -4744,21 +4744,17 @@ static void lockdep_free_key_range_reg(void *start, unsigned long size)
{ {
struct pending_free *pf; struct pending_free *pf;
unsigned long flags; unsigned long flags;
int locked;
init_data_structures_once(); init_data_structures_once();
raw_local_irq_save(flags); raw_local_irq_save(flags);
locked = graph_lock(); arch_spin_lock(&lockdep_lock);
if (!locked) current->lockdep_recursion = 1;
goto out_irq;
pf = get_pending_free(); pf = get_pending_free();
__lockdep_free_key_range(pf, start, size); __lockdep_free_key_range(pf, start, size);
call_rcu_zapped(pf); call_rcu_zapped(pf);
current->lockdep_recursion = 0;
graph_unlock(); arch_spin_unlock(&lockdep_lock);
out_irq:
raw_local_irq_restore(flags); raw_local_irq_restore(flags);
/* /*
...@@ -4911,9 +4907,8 @@ void lockdep_unregister_key(struct lock_class_key *key) ...@@ -4911,9 +4907,8 @@ void lockdep_unregister_key(struct lock_class_key *key)
return; return;
raw_local_irq_save(flags); raw_local_irq_save(flags);
if (!graph_lock()) arch_spin_lock(&lockdep_lock);
goto out_irq; current->lockdep_recursion = 1;
pf = get_pending_free(); pf = get_pending_free();
hlist_for_each_entry_rcu(k, hash_head, hash_entry) { hlist_for_each_entry_rcu(k, hash_head, hash_entry) {
if (k == key) { if (k == key) {
...@@ -4925,8 +4920,8 @@ void lockdep_unregister_key(struct lock_class_key *key) ...@@ -4925,8 +4920,8 @@ void lockdep_unregister_key(struct lock_class_key *key)
WARN_ON_ONCE(!found); WARN_ON_ONCE(!found);
__lockdep_free_key_range(pf, key, 1); __lockdep_free_key_range(pf, key, 1);
call_rcu_zapped(pf); call_rcu_zapped(pf);
graph_unlock(); current->lockdep_recursion = 0;
out_irq: arch_spin_unlock(&lockdep_lock);
raw_local_irq_restore(flags); raw_local_irq_restore(flags);
/* Wait until is_dynamic_key() has finished accessing k->hash_entry. */ /* Wait until is_dynamic_key() has finished accessing k->hash_entry. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment