]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
scsi: stex: Fix reboot_notifier leak in probe error path
authorHaotian Zhang <vulab@iscas.ac.cn>
Tue, 4 Nov 2025 09:48:47 +0000 (17:48 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Sat, 8 Nov 2025 17:11:06 +0000 (12:11 -0500)
In stex_probe(), register_reboot_notifier() is called at the beginning,
but if any subsequent initialization step fails, the function returns
without unregistering the notifier, resulting in a resource leak.

Add unregister_reboot_notifier() in the out_disable error path to ensure
proper cleanup on all failure paths.

Fixes: 61b745fa63db ("scsi: stex: Add S6 support")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Link: https://patch.msgid.link/20251104094847.270-1-vulab@iscas.ac.cn
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/stex.c

index d8ad02c293205816afde44b304cbb49b1a27626a..e02f28e5a104e42c56a25a6d57d7e3c400c56594 100644 (file)
@@ -1844,6 +1844,7 @@ out_release_regions:
 out_scsi_host_put:
        scsi_host_put(host);
 out_disable:
+       unregister_reboot_notifier(&stex_notifier);
        pci_disable_device(pdev);
 
        return err;