Skip to contentSkip to conversation

sparc32,leon: Check for existent irq_map entry in leon_handle_ext_irq

PATCH Applied Andreas Larsson 3 participants 3 messages Oct 30, 2012 – Nov 10, 2012 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore

Andreas Larsson

author maintainer
#0 lore raw

PATCH 1/1 sparc32,leon: Check for existent irq_map entry in leon_handle_ext_irq

If an irq is being unlinked concurrently with leon_handle_ext_irq, irq_map[eirq] might be null in leon_handle_ext_irq. Make sure that this is not dereferenced.

---
 arch/sparc/kernel/leon_kernel.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
arch/sparc/kernel/leon_kernel.c +4 -2
index f8b6eee..87f60ee 100644
@@ -56,11 +56,13 @@ static inline unsigned int leon_eirq_get(int cpu)
 static void leon_handle_ext_irq(unsigned int irq, struct irq_desc *desc)
 {
 	unsigned int eirq;
+	struct irq_bucket *p;
 	int cpu = sparc_leon3_cpuid();
 
 	eirq = leon_eirq_get(cpu);
-	if ((eirq & 0x10) && irq_map[eirq]->irq) /* bit4 tells if IRQ happened */
-		generic_handle_irq(irq_map[eirq]->irq);
+	p = irq_map[eirq];
+	if ((eirq & 0x10) && p && p->irq) /* bit4 tells if IRQ happened */
+		generic_handle_irq(p->irq);
 }
 
 /* The extended IRQ controller has been found, this function registers it */
Signature · 1 line
1.7.0.4