Skip to contentSkip to conversation

scsi: ips: Fix potential ioremap memory leak in ips_init_phase1()

PATCH New Zhen Ni 1 participant 1 message Sep 30, 2025

Subsystems (4)
lore
Share & tools
lore

Zhen Ni

author
#0 lore raw

PATCH 1/1 scsi: ips: Fix potential ioremap memory leak in ips_init_phase1()

In ips_init_phase1(), most early-exit error paths use ips_abort_init(), which properly releases ioremap_ptr. However, the path where kzalloc() fails does not go through ips_abort_init() and therefore skips unmapping ioremap_ptr, leading to a potential resource leak.

Add the missing iounmap() call in this specific failure path.

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
---
 drivers/scsi/ips.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/scsi/ips.c +2 -0
index 94adb6ac02a4..a34167ec3038 100644
@@ -6877,6 +6877,8 @@ ips_init_phase1(struct pci_dev *pci_dev, int *indexPtr)
 	if (ha == NULL) {
 		IPS_PRINTK(KERN_WARNING, pci_dev,
 			   "Unable to allocate temporary ha struct\n");
+		if (ioremap_ptr)
+			iounmap(ioremap_ptr);
 		return -1;
 	}
 
Signature · 1 line
2.20.1