lockdep: fix potential NULL pointer dereferences
PATCH 1/1 lockdep: fix potential NULL pointer dereferences
Hello,
In general we can get the symbol name of a particular lock and print it out if something went wrong regarding lock/unlock stuff.
However, I observed the following info(3.5.0-rc4) when running quotacheck(1) yesterday. It has occurred only once, I can not reproduced it afterwards.
[15800.938071] quotacheck/11934 is trying to release lock ( [15800.940040] BUG: unable to handle kernel NULL pointer dereference at 0000007c [15800.940040] IP: [<c10f9b2c>] print_lockdep_cache+0x15/0x86 [15800.940040] *pde = 00000000 [15800.940040] Oops: 0000 [#1] SMP DEBUG_PAGEALLOC
Maybe something wrong at other areas, but I also noticed there is no defense for __get_key_name() failure at both __print_lock_name() and print_lockdep_cache().
How about to trigger BUG_ON() to indicate it a bit more explicit once such situation is detected?
Thanks,
-Jeff
Signed-off-by Jie Liu <[email protected]>
--- kernel/lockdep.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
kernel/lockdep.c +2 -0
@@ -508,6 +508,7 @@ static void __print_lock_name(struct lock_class *class) name = class->name;if (!name) { name =__get_key_name (class->key, str); +BUG_ON (!name);printk ("%s" , name); }else {printk ("%s" , name);
@@ -538,6 +539,7 @@ static void print_lockdep_cache(struct lockdep_map *lock)if (!name) name =__get_key_name (lock->key->subkeys, str); +BUG_ON (!name);printk ("%s" , name); }
Signature · 1 line
1.7.9