diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2009-03-04 07:51:13 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-03-04 12:38:33 -0500 |
commit | 1c21f14ec48a2256fb03682b24dddd23eacdc96f (patch) | |
tree | 03b6ecf8d87074d1f154ff8ac794e9084e00d7cd /kernel/lockdep.c | |
parent | 6700ec65c207068a81a535e9dca616fefac21671 (diff) |
lockdep: fix incorrect state name
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>
Diffstat (limited to 'kernel/lockdep.c')
-rw-r--r-- | kernel/lockdep.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/lockdep.c b/kernel/lockdep.c index 022d2ed7fd8b..ef6584fd9fe5 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c | |||
@@ -2015,7 +2015,8 @@ typedef int (*check_usage_f)(struct task_struct *, struct held_lock *, | |||
2015 | enum lock_usage_bit bit, const char *name); | 2015 | enum lock_usage_bit bit, const char *name); |
2016 | 2016 | ||
2017 | static int | 2017 | static int |
2018 | mark_lock_irq(struct task_struct *curr, struct held_lock *this, int new_bit) | 2018 | mark_lock_irq(struct task_struct *curr, struct held_lock *this, |
2019 | enum lock_usage_bit new_bit) | ||
2019 | { | 2020 | { |
2020 | int excl_bit = exclusive_bit(new_bit); | 2021 | int excl_bit = exclusive_bit(new_bit); |
2021 | int read = new_bit & 1; | 2022 | int read = new_bit & 1; |
@@ -2043,7 +2044,7 @@ mark_lock_irq(struct task_struct *curr, struct held_lock *this, int new_bit) | |||
2043 | * states. | 2044 | * states. |
2044 | */ | 2045 | */ |
2045 | if ((!read || !dir || STRICT_READ_CHECKS) && | 2046 | if ((!read || !dir || STRICT_READ_CHECKS) && |
2046 | !usage(curr, this, excl_bit, state_name(new_bit))) | 2047 | !usage(curr, this, excl_bit, state_name(new_bit & ~1))) |
2047 | return 0; | 2048 | return 0; |
2048 | 2049 | ||
2049 | /* | 2050 | /* |