[PATCH 1/2] ASoC: sound: atmel: ac97c: Fix IRQ handler null pointer dereference
Manish Baing <[email protected]>
| Newsgroups | org.kernel.vger.linux-sound,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
In atmel_ac97c_probe(), request_irq() is called before ioremap(). If an interrupt fires immediately, the handler atmel_ac97c_interrupt() will attempt to dereference chip->regs via ac97c_readl(), leading to a null pointer dereference and kernel panic. Move request_irq() to the end of the probe function, after memory is mapped and clocks are enabled, ensuring the hardware is fully ready before interrupts are serviced. Running make W=1 returns no errors. I was unable to test the patch because I do not have the hardware. The issue was flagged by the Sashiko AI bot. Link: https://sashiko.dev/#/patchset/[email protected]?part=1 Reported-by: Sashiko AI <[email protected]> Signed-off-by: Manish Baing <[email protected]> --- sound/atmel/ac97c.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c index e394205f469b..205475157e72 100644 --- a/sound/atmel/ac97c.c +++ b/sound/atmel/ac97c.c @@ -733,11 +733,6 @@ static int atmel_ac97c_probe(struct platform_device *pdev) chip = get_chip(card); - retval = request_irq(irq, atmel_ac97c_interrupt, 0, "AC97C", chip); - if (retval) { - dev_dbg(&pdev->dev, "unable to request irq %d\n", irq); - goto err_request_irq; - } chip->irq = irq; spin_lock_init(&chip->lock); @@ -785,6 +780,12 @@ static int atmel_ac97c_probe(struct platform_device *pdev) goto err_ac97_bus; } + retval = request_irq(irq, atmel_ac97c_interrupt, 0, "AC97C", chip); + if (retval) { + dev_dbg(&pdev->dev, "unable to request irq %d\n", irq); + goto err_request_irq; + } + retval = snd_card_register(card); if (retval) { dev_dbg(&pdev->dev, "could not register sound card\n"); -- 2.43.0