* [PATCH] scsi: stex: fix reboot_notifier leak in probe error path
@ 2025-11-04 9:48 Haotian Zhang
2025-11-08 17:11 ` Martin K. Petersen
2025-11-13 2:46 ` Martin K. Petersen
0 siblings, 2 replies; 3+ messages in thread
From: Haotian Zhang @ 2025-11-04 9:48 UTC (permalink / raw)
To: James E . J . Bottomley, Martin K . Petersen
Cc: linux-scsi, linux-kernel, Haotian Zhang
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>
---
drivers/scsi/stex.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index 63ed7f9aaa93..34a557297fef 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -1844,6 +1844,7 @@ static int stex_probe(struct pci_dev *pdev, const struct pci_device_id *id)
out_scsi_host_put:
scsi_host_put(host);
out_disable:
+ unregister_reboot_notifier(&stex_notifier);
pci_disable_device(pdev);
return err;
--
2.50.1.windows.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi: stex: fix reboot_notifier leak in probe error path
2025-11-04 9:48 [PATCH] scsi: stex: fix reboot_notifier leak in probe error path Haotian Zhang
@ 2025-11-08 17:11 ` Martin K. Petersen
2025-11-13 2:46 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2025-11-08 17:11 UTC (permalink / raw)
To: Haotian Zhang
Cc: James E . J . Bottomley, Martin K . Petersen, linux-scsi, linux-kernel
Haotian,
> 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.
Applied to 6.19/scsi-staging, thanks!
--
Martin K. Petersen
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi: stex: fix reboot_notifier leak in probe error path
2025-11-04 9:48 [PATCH] scsi: stex: fix reboot_notifier leak in probe error path Haotian Zhang
2025-11-08 17:11 ` Martin K. Petersen
@ 2025-11-13 2:46 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2025-11-13 2:46 UTC (permalink / raw)
To: James E . J . Bottomley, Haotian Zhang
Cc: Martin K . Petersen, linux-scsi, linux-kernel
On Tue, 04 Nov 2025 17:48:47 +0800, Haotian Zhang wrote:
> 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.
>
> [...]
Applied to 6.19/scsi-queue, thanks!
[1/1] scsi: stex: fix reboot_notifier leak in probe error path
https://git.kernel.org/mkp/scsi/c/20da637eb545
--
Martin K. Petersen
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-13 2:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-04 9:48 [PATCH] scsi: stex: fix reboot_notifier leak in probe error path Haotian Zhang
2025-11-08 17:11 ` Martin K. Petersen
2025-11-13 2:46 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®