Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: sim710: Fix resource leak by adding missing ioport_unmap() calls

The driver calls ioport_map() to map I/O ports in sim710_probe_common()
but never calls ioport_unmap() to release the mapping. This causes
resource leaks in both the error path when request_irq() fails and in
the normal device removal path via sim710_device_remove().

Add ioport_unmap() calls in the out_release error path and in
sim710_device_remove().

Fixes: 56fece20086e ("[PATCH] finally fix 53c700 to use the generic iomem infrastructure")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Link: https://patch.msgid.link/20251029032555.1476-1-vulab@iscas.ac.cn
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Haotian Zhang and committed by
Martin K. Petersen
acd194d9 f6ab5946

+2
+2
drivers/scsi/sim710.c
··· 133 133 out_put_host: 134 134 scsi_host_put(host); 135 135 out_release: 136 + ioport_unmap(hostdata->base); 136 137 release_region(base_addr, 64); 137 138 out_free: 138 139 kfree(hostdata); ··· 149 148 150 149 scsi_remove_host(host); 151 150 NCR_700_release(host); 151 + ioport_unmap(hostdata->base); 152 152 kfree(hostdata); 153 153 free_irq(host->irq, host); 154 154 release_region(host->base, 64);