Skip to content

Commit 4028b42

Browse files
Peter Zijlstragregkh
authored andcommitted
lockdep: Fix preemption WARN for spurious IRQ-enable
[ Upstream commit f8e48a3 ] It is valid (albeit uncommon) to call local_irq_enable() without first having called local_irq_disable(). In this case we enter lockdep_hardirqs_on*() with IRQs enabled and trip a preemption warning for using __this_cpu_read(). Use this_cpu_read() instead to avoid the warning. Fixes: 4d00409 ("lockdep: Fix lockdep recursion") Reported-by: syzbot+53f8ce8bbc07924b6417@syzkaller.appspotmail.com Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 9558038 commit 4028b42

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

kernel/locking/lockdep.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3681,7 +3681,7 @@ void lockdep_hardirqs_on_prepare(unsigned long ip)
36813681
if (unlikely(in_nmi()))
36823682
return;
36833683

3684-
if (unlikely(__this_cpu_read(lockdep_recursion)))
3684+
if (unlikely(this_cpu_read(lockdep_recursion)))
36853685
return;
36863686

36873687
if (unlikely(lockdep_hardirqs_enabled())) {
@@ -3750,7 +3750,7 @@ void noinstr lockdep_hardirqs_on(unsigned long ip)
37503750
goto skip_checks;
37513751
}
37523752

3753-
if (unlikely(__this_cpu_read(lockdep_recursion)))
3753+
if (unlikely(this_cpu_read(lockdep_recursion)))
37543754
return;
37553755

37563756
if (lockdep_hardirqs_enabled()) {

0 commit comments

Comments
 (0)