linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] lockdep: fix potential NULL pointer dereferences
@ 2012-08-16 14:12 Jeff Liu
  0 siblings, 0 replies; only message in thread
From: Jeff Liu @ 2012-08-16 14:12 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org

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 <jeff.liu@oracle.com>

---
 kernel/lockdep.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index ea9ee45..dfbcd86 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -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);
 }
 
-- 
1.7.9

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-08-16 14:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-16 14:12 [PATCH] lockdep: fix potential NULL pointer dereferences Jeff Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).