lockdep: fix incorrect state name
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Wed, 4 Mar 2009 12:51:13 +0000 (13:51 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 4 Mar 2009 17:38:33 +0000 (18:38 +0100)
In the recent mark_lock_irq() rework a bug snuck in that would report the
state of write locks causing irq inversion under a read lock as a read
lock.

Fix this by masking the read bit of the state when validating write
dependencies.

Reported-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1236172646.5330.7450.camel@laptop>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/lockdep.c

index 022d2ed7fd8bf6644f7fb636dc4f5bbd361066b1..ef6584fd9fe570d39b2bedf3393eda3d2473d400 100644 (file)
@@ -2015,7 +2015,8 @@ typedef int (*check_usage_f)(struct task_struct *, struct held_lock *,
                             enum lock_usage_bit bit, const char *name);
 
 static int
-mark_lock_irq(struct task_struct *curr, struct held_lock *this, int new_bit)
+mark_lock_irq(struct task_struct *curr, struct held_lock *this,
+               enum lock_usage_bit new_bit)
 {
        int excl_bit = exclusive_bit(new_bit);
        int read = new_bit & 1;
@@ -2043,7 +2044,7 @@ mark_lock_irq(struct task_struct *curr, struct held_lock *this, int new_bit)
         * states.
         */
        if ((!read || !dir || STRICT_READ_CHECKS) &&
-                       !usage(curr, this, excl_bit, state_name(new_bit)))
+                       !usage(curr, this, excl_bit, state_name(new_bit & ~1)))
                return 0;
 
        /*
This page took 0.027845 seconds and 5 git commands to generate.