[patch] lockdep: fix possible race while disabling lock-debugging, restore fix

From: Ingo Molnar
Date: Mon Dec 11 2006 - 02:31:16 EST



* Jarek Poplawski <jarkao2@xxxxx> wrote:

> ...
> > @@ -1212,7 +1244,8 @@ register_lock_class(struct lockdep_map *
> > hash_head = classhashentry(key);
> >
> > raw_local_irq_save(flags);
> > - __raw_spin_lock(&hash_lock);
> > + if (!graph_lock())
>
> ! raw_local_irq_restore(flags);
>
> > + return NULL;

yeah. Fix below.

Ingo

Subject: [patch] lockdep: fix possible race while disabling lock-debugging, restore fix
From: Ingo Molnar <mingo@xxxxxxx>

restore flags in failure branch, pointed out by Jarek Poplawski.

Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
---
kernel/lockdep.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Index: linux/kernel/lockdep.c
===================================================================
--- linux.orig/kernel/lockdep.c
+++ linux/kernel/lockdep.c
@@ -1244,8 +1244,10 @@ register_lock_class(struct lockdep_map *
hash_head = classhashentry(key);

raw_local_irq_save(flags);
- if (!graph_lock())
+ if (!graph_lock()) {
+ raw_local_irq_restore(flags);
return NULL;
+ }
/*
* We have to do the hash-walk again, to avoid races
* with another CPU:
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/