Skip to contentSkip to conversation

lockdep: dovetail: fix unbalanced hard_cond_local_irq_restore

PATCH Applied Jan Kiszka 2 participants 2 messages Nov 27 – Nov 28 Locking primitives

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 lockdep: dovetail: fix unbalanced hard_cond_local_irq_restore

From: Jan Kiszka <[email protected]>

After the skip_checks block comes a hard_cond_local_irq_restore() - but we were not initializing flags when jumping from here.

We are in NMI context here, thus IRQs disabling is technically unneeded but a) symmetric to the hard_cond_local_irq_restore and b) truly gone when IRQ_PIPELINE is off.

Reported-by OpenCode:Opus-5.5
Fixes f9acdddb8afc, 5.15 ("irq_pipeline: lockdep: fix irq state causing deadlock")

---

It took backports from 7.3 down to 5.15, each reviewed by the same AI, to finally make it spot this.

 kernel/locking/lockdep.c | 1 +
 1 file changed, 1 insertion(+)
kernel/locking/lockdep.c +1 -0
index 08bb0173dad77..4d91327a2a6ce 100644
@@ -4535,6 +4535,7 @@ void noinstr lockdep_hardirqs_on(unsigned long ip)
 		 *  - hardware state check, because above;
 		 *  - chain_key check, see lockdep_hardirqs_on_prepare().
 		 */
+		flags = hard_cond_local_irq_save();
 		goto skip_checks;
 	}
 
Signature · 1 line
2.47.3
#1 lore raw
Quoted 25 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

After the skip_checks block comes a hard_cond_local_irq_restore() - but we were not initializing flags when jumping from here.

We are in NMI context here, thus IRQs disabling is technically unneeded but a) symmetric to the hard_cond_local_irq_restore and b) truly gone when IRQ_PIPELINE is off.

Reported-by OpenCode:Opus-5.5
Fixes f9acdddb8afc, 5.15 ("irq_pipeline: lockdep: fix irq state causing deadlock")

---

It took backports from 7.3 down to 5.15, each reviewed by the same AI, to finally make it spot this.

 kernel/locking/lockdep.c | 1 +
 1 file changed, 1 insertion(+)
kernel/locking/lockdep.c +0 -0
index 08bb0173dad77..4d91327a2a6ce 100644

kernel/locking/lockdep.c void noinstr lockdep_hardirqs_on(unsigned long ip) · line 4540

Quoted 6 lines
kernel/locking/lockdep.c +1 -0
@@ -4535,6 +4535,7 @@ void noinstr lockdep_hardirqs_on(unsigned long ip)
 		 *  - hardware state check, because above;
 		 *  - chain_key check, see lockdep_hardirqs_on_prepare().
 		 */
+		flags = hard_cond_local_irq_save();
 		goto skip_checks;
 	}

Merged, thanks.

Signature · 1 line
Philippe.