diff options
author | Peter Zijlstra <[email protected]> | 2015-06-02 12:50:13 +0200 |
---|---|---|
committer | Ingo Molnar <[email protected]> | 2015-06-07 15:46:30 +0200 |
commit | cee34d88cabd1ba5fc93e09b5b12232bc9338c7c (patch) | |
tree | 278d17b06e20285f8c2822d724ecc41a69b27e9d /kernel/gcov/gcov.h | |
parent | 37ef1647b7f73d4ff4c7993984599b6c4f26443a (diff) |
lockdep: Fix a race between /proc/lock_stat and module unload
The lock_class iteration of /proc/lock_stat is not serialized against
the lockdep_free_key_range() call from module unload.
Therefore it can happen that we find a class of which ->name/->key are
no longer valid.
There is a further bug in zap_class() that left ->name dangling. Cure
this. Use RCU_INIT_POINTER() because NULL.
Since lockdep_free_key_range() is rcu_sched serialized, we can read
both ->name and ->key under rcu_read_lock_sched() (preempt-disable)
and be assured that if we observe a !NULL value it stays safe to use
for as long as we hold that lock.
If we observe both NULL, skip the entry.
Reported-by: Jerome Marchand <[email protected]>
Tested-by: Jerome Marchand <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
Diffstat (limited to 'kernel/gcov/gcov.h')
0 files changed, 0 insertions, 0 deletions