From: Peter Zijlstra Date: Thu, 22 Oct 2020 10:23:02 +0000 (+0200) Subject: lockdep: Fix preemption WARN for spurious IRQ-enable X-Git-Tag: v5.10-rc2~4^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f8e48a3dca060e80f672d398d181db1298fbc86c;p=thirdparty%2Fkernel%2Flinux.git lockdep: Fix preemption WARN for spurious IRQ-enable 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: 4d004099a6 ("lockdep: Fix lockdep recursion") Reported-by: syzbot+53f8ce8bbc07924b6417@syzkaller.appspotmail.com Reported-by: kernel test robot Signed-off-by: Peter Zijlstra (Intel) --- diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 3e99dfef84084..fc206aefa9708 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -4057,7 +4057,7 @@ void lockdep_hardirqs_on_prepare(unsigned long ip) if (unlikely(in_nmi())) return; - if (unlikely(__this_cpu_read(lockdep_recursion))) + if (unlikely(this_cpu_read(lockdep_recursion))) return; if (unlikely(lockdep_hardirqs_enabled())) { @@ -4126,7 +4126,7 @@ void noinstr lockdep_hardirqs_on(unsigned long ip) goto skip_checks; } - if (unlikely(__this_cpu_read(lockdep_recursion))) + if (unlikely(this_cpu_read(lockdep_recursion))) return; if (lockdep_hardirqs_enabled()) {