Commit:     fabe874a48de45b137f99b4ed3641e0413f465ce
Parent:     4784b11c4f49eb88f2dd74df6afc5170f193cedc
Author:     Arjan van de Ven <[EMAIL PROTECTED]>
AuthorDate: Thu Jan 24 07:00:45 2008 +0100
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Thu Jan 24 08:01:09 2008 -0800

    lockdep: fix kernel crash on module unload
    Michael Wu noticed in his lkml post at
    that certain wireless drivers ended up having their name in module
    memory, which would then crash the kernel on module unload.
    The patch he proposed was a bit clumsy in that it increased the size of
    a lockdep entry significantly; the patch below tries another approach,
    it checks, on module teardown, if the name of a class is in module space
    and then zaps the class.  This is very similar to what we already do
    with keys that are in module space.
    Signed-off-by: Arjan van de Ven <[EMAIL PROTECTED]>
    Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
    Acked-by: Peter Zijlstra <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
 kernel/lockdep.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 4335f12..e2c07ec 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -2932,7 +2932,7 @@ static void zap_class(struct lock_class *class)
-static inline int within(void *addr, void *start, unsigned long size)
+static inline int within(const void *addr, void *start, unsigned long size)
        return addr >= start && addr < start + size;
@@ -2955,9 +2955,12 @@ void lockdep_free_key_range(void *start, unsigned long 
                head = classhash_table + i;
                if (list_empty(head))
-               list_for_each_entry_safe(class, next, head, hash_entry)
+               list_for_each_entry_safe(class, next, head, hash_entry) {
                        if (within(class->key, start, size))
+                       else if (within(class->name, start, size))
+                               zap_class(class);
+               }
        if (locked)
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to