Skip to content

Commit 18eb77c

Browse files
RengarajanSSgregkh
authored andcommitted
misc: microchip: pci1xxxx: Fix Kernel panic during IRQ handler registration
Resolve kernel panic while accessing IRQ handler associated with the generated IRQ. This is done by acquiring the spinlock and storing the current interrupt state before handling the interrupt request using generic_handle_irq. A previous fix patch was submitted where 'generic_handle_irq' was replaced with 'handle_nested_irq'. However, this change also causes the kernel panic where after determining which GPIO triggered the interrupt and attempting to call handle_nested_irq with the mapped IRQ number, leads to a failure in locating the registered handler. Fixes: 194f9f9 ("misc: microchip: pci1xxxx: Resolve kernel panic during GPIO IRQ handling") Cc: stable <stable@kernel.org> Signed-off-by: Rengarajan S <rengarajan.s@microchip.com> Link: https://lore.kernel.org/r/20250313170856.20868-2-rengarajan.s@microchip.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c876be9 commit 18eb77c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
struct pci1xxxx_gpio {
3838
struct auxiliary_device *aux_dev;
3939
void __iomem *reg_base;
40+
raw_spinlock_t wa_lock;
4041
struct gpio_chip gpio;
4142
spinlock_t lock;
4243
int irq_base;
@@ -257,6 +258,7 @@ static irqreturn_t pci1xxxx_gpio_irq_handler(int irq, void *dev_id)
257258
struct pci1xxxx_gpio *priv = dev_id;
258259
struct gpio_chip *gc = &priv->gpio;
259260
unsigned long int_status = 0;
261+
unsigned long wa_flags;
260262
unsigned long flags;
261263
u8 pincount;
262264
int bit;
@@ -280,7 +282,9 @@ static irqreturn_t pci1xxxx_gpio_irq_handler(int irq, void *dev_id)
280282
writel(BIT(bit), priv->reg_base + INTR_STATUS_OFFSET(gpiobank));
281283
spin_unlock_irqrestore(&priv->lock, flags);
282284
irq = irq_find_mapping(gc->irq.domain, (bit + (gpiobank * 32)));
283-
handle_nested_irq(irq);
285+
raw_spin_lock_irqsave(&priv->wa_lock, wa_flags);
286+
generic_handle_irq(irq);
287+
raw_spin_unlock_irqrestore(&priv->wa_lock, wa_flags);
284288
}
285289
}
286290
spin_lock_irqsave(&priv->lock, flags);

0 commit comments

Comments
 (0)