[PATCH] gpib: ines: Fix resource leak in ines_isa_attach()
From: Hongling Zeng
Date: Wed May 27 2026 - 22:03:35 EST
When request_irq() fails in ines_isa_attach(), the function returns -1
without releasing the I/O port region that was successfully acquired
earlier by request_region(). This causes a resource leak.
Fix this by adding a proper error path that releases the I/O port
region before returning.
Fixes: 0de51244e7b7e3 ("gpib: ines: use request_region for isa devices")
Signed-off-by: Hongling Zeng <zenghongling@xxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
---
drivers/gpib/ines/ines_gpib.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/gpib/ines/ines_gpib.c b/drivers/gpib/ines/ines_gpib.c
index c000f647fbb5..1e5112d05dfc 100644
--- a/drivers/gpib/ines/ines_gpib.c
+++ b/drivers/gpib/ines/ines_gpib.c
@@ -911,11 +911,16 @@ static int ines_isa_attach(struct gpib_board *board, const struct gpib_board_con
nec7210_board_reset(nec_priv, board);
if (request_irq(config->ibirq, ines_pci_interrupt, isr_flags, DRV_NAME, board)) {
dev_err(board->gpib_dev, "failed to allocate IRQ %d\n", config->ibirq);
- return -1;
+ retval = -ENODEV;
+ goto err_release_region;
}
ines_priv->irq = config->ibirq;
ines_online(ines_priv, board, 1);
return 0;
+
+err_release_region:
+ release_region(config->ibbase, ines_isa_iosize);
+ return retval;
}
static void ines_pci_detach(struct gpib_board *board)
--
2.25.1