From: Jeff Liu <jeff.liu@oracle.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] lockdep: fix potential NULL pointer dereferences
Date: Thu, 16 Aug 2012 22:12:06 +0800 [thread overview]
Message-ID: <502CFFB6.3080006@oracle.com> (raw)
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
reply other threads:[~2012-08-16 14:12 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=502CFFB6.3080006@oracle.com \
--to=jeff.liu@oracle.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.