mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] genirq/irqdesc: Fix deadlock when reading hwirq
@ 2025-05-21 14:25 Claudiu
  2025-05-21 15:57 ` [tip: irq/core] genirq/irqdesc: Remove double locking in hwirq_show() tip-bot2 for Claudiu Beznea
  0 siblings, 1 reply; 2+ messages in thread
From: Claudiu @ 2025-05-21 14:25 UTC (permalink / raw)
  To: tglx, peterz, jirislaby; +Cc: claudiu.beznea, linux-kernel, Claudiu Beznea

From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

The &desc->lock is acquired on 2 consecutive lines in hwirq_show(). This
leads to deadlock when reading hwirq. Drop the raw_spin_lock_irq() and
keep guard().

Fixes: 5d964a9f7cd8 ("genirq/irqdesc: Switch to lock guards")
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
 kernel/irq/irqdesc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index 6d006a68ff85..b64c57b44c20 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -281,7 +281,6 @@ static ssize_t hwirq_show(struct kobject *kobj, struct kobj_attribute *attr, cha
 	struct irq_desc *desc = container_of(kobj, struct irq_desc, kobj);
 
 	guard(raw_spinlock_irq)(&desc->lock);
-	raw_spin_lock_irq(&desc->lock);
 	if (desc->irq_data.domain)
 		return sysfs_emit(buf, "%lu\n", desc->irq_data.hwirq);
 	return 0;
-- 
2.43.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [tip: irq/core] genirq/irqdesc: Remove double locking in hwirq_show()
  2025-05-21 14:25 [PATCH] genirq/irqdesc: Fix deadlock when reading hwirq Claudiu
@ 2025-05-21 15:57 ` tip-bot2 for Claudiu Beznea
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot2 for Claudiu Beznea @ 2025-05-21 15:57 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Claudiu Beznea, Thomas Gleixner, x86, linux-kernel, maz

The following commit has been merged into the irq/core branch of tip:

Commit-ID:     a510bb87da72aa8d1504b0e4b343cfe013ee8a89
Gitweb:        https://git.kernel.org/tip/a510bb87da72aa8d1504b0e4b343cfe013ee8a89
Author:        Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
AuthorDate:    Wed, 21 May 2025 17:25:41 +03:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Wed, 21 May 2025 17:48:23 +02:00

genirq/irqdesc: Remove double locking in hwirq_show()

&desc->lock is acquired on 2 consecutive lines in hwirq_show(). This leads
obviously to a deadlock. Drop the raw_spin_lock_irq() and keep guard().

Fixes: 5d964a9f7cd8 ("genirq/irqdesc: Switch to lock guards")
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250521142541.3832130-1-claudiu.beznea.uj@bp.renesas.com

---
 kernel/irq/irqdesc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index 6d006a6..b64c57b 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -281,7 +281,6 @@ static ssize_t hwirq_show(struct kobject *kobj, struct kobj_attribute *attr, cha
 	struct irq_desc *desc = container_of(kobj, struct irq_desc, kobj);
 
 	guard(raw_spinlock_irq)(&desc->lock);
-	raw_spin_lock_irq(&desc->lock);
 	if (desc->irq_data.domain)
 		return sysfs_emit(buf, "%lu\n", desc->irq_data.hwirq);
 	return 0;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-05-21 15:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-21 14:25 [PATCH] genirq/irqdesc: Fix deadlock when reading hwirq Claudiu
2025-05-21 15:57 ` [tip: irq/core] genirq/irqdesc: Remove double locking in hwirq_show() tip-bot2 for Claudiu Beznea

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®