mirror of
https://github.com/torvalds/linux.git
synced 2026-05-12 16:18:45 +02:00
parisc: Fix IRQ leak in LASI driver
When request_irq() succeeds but gsc_common_setup() fails later, the IRQ is never released. Fix this by adding proper error handling with goto labels to ensure resources are released in LIFO order. Detected by Smatch: drivers/parisc/lasi.c:216 lasi_init_chip() warn: 'lasi->gsc_irq.irq' from request_irq() not released on lines: 207. Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <error27@gmail.com> Closes: https://lore.kernel.org/r/202604180957.4QdAIxP6-lkp@intel.com/ Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn> Cc: stable@vger.kernel.org Signed-off-by: Helge Deller <deller@gmx.de>
This commit is contained in:
parent
41ca998fbe
commit
37b0dc5e27
|
|
@ -193,8 +193,7 @@ static int __init lasi_init_chip(struct parisc_device *dev)
|
||||||
|
|
||||||
ret = request_irq(lasi->gsc_irq.irq, gsc_asic_intr, 0, "lasi", lasi);
|
ret = request_irq(lasi->gsc_irq.irq, gsc_asic_intr, 0, "lasi", lasi);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
kfree(lasi);
|
goto err_free;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* enable IRQ's for devices below LASI */
|
/* enable IRQ's for devices below LASI */
|
||||||
|
|
@ -203,8 +202,7 @@ static int __init lasi_init_chip(struct parisc_device *dev)
|
||||||
/* Done init'ing, register this driver */
|
/* Done init'ing, register this driver */
|
||||||
ret = gsc_common_setup(dev, lasi);
|
ret = gsc_common_setup(dev, lasi);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
kfree(lasi);
|
goto err_irq;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gsc_fixup_irqs(dev, lasi, lasi_choose_irq);
|
gsc_fixup_irqs(dev, lasi, lasi_choose_irq);
|
||||||
|
|
@ -214,6 +212,12 @@ static int __init lasi_init_chip(struct parisc_device *dev)
|
||||||
SYS_OFF_PRIO_DEFAULT, lasi_power_off, lasi);
|
SYS_OFF_PRIO_DEFAULT, lasi_power_off, lasi);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
err_irq:
|
||||||
|
free_irq(lasi->gsc_irq.irq, lasi);
|
||||||
|
err_free:
|
||||||
|
kfree(lasi);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct parisc_device_id lasi_tbl[] __initdata = {
|
static struct parisc_device_id lasi_tbl[] __initdata = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user