Skip to content

Commit d48f03f

Browse files
Peter Zijlstragregkh
authored andcommitted
locking/lockdep: Avoid unmatched unlock
[ Upstream commit 7f82e63 ] Commit f6f48e1 ("lockdep: Teach lockdep about "USED" <- "IN-NMI" inversions") overlooked that print_usage_bug() releases the graph_lock and called it without the graph lock held. Fixes: f6f48e1 ("lockdep: Teach lockdep about "USED" <- "IN-NMI" inversions") Reported-by: Dmitry Vyukov <dvyukov@google.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Waiman Long <longman@redhat.com> Link: https://lkml.kernel.org/r/YBfkuyIfB1+VRxXP@hirez.programming.kicks-ass.net Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 2e0e7c9 commit d48f03f

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

kernel/locking/lockdep.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3707,7 +3707,7 @@ static void
37073707
print_usage_bug(struct task_struct *curr, struct held_lock *this,
37083708
enum lock_usage_bit prev_bit, enum lock_usage_bit new_bit)
37093709
{
3710-
if (!debug_locks_off_graph_unlock() || debug_locks_silent)
3710+
if (!debug_locks_off() || debug_locks_silent)
37113711
return;
37123712

37133713
pr_warn("\n");
@@ -3748,6 +3748,7 @@ valid_state(struct task_struct *curr, struct held_lock *this,
37483748
enum lock_usage_bit new_bit, enum lock_usage_bit bad_bit)
37493749
{
37503750
if (unlikely(hlock_class(this)->usage_mask & (1 << bad_bit))) {
3751+
graph_unlock();
37513752
print_usage_bug(curr, this, bad_bit, new_bit);
37523753
return 0;
37533754
}

0 commit comments

Comments
 (0)