Linux SCSI subsystem development
 help / color / mirror / Atom feed
* [PATCH] scsi: st: Free the reserved page array on probe failure
@ 2026-12-02  4:14 Haoxiang Li
  2026-12-02  4:19 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Haoxiang Li @ 2026-12-02  4:14 UTC (permalink / raw)
  To: loberman, jmeneghi, James.Bottomley, mkp, fujita.tomonori,
	Kai.Makisara
  Cc: linux-scsi, Haoxiang Li

new_tape_buffer() allocates a buffer and page pointers.
However, if subsequent probe setup fails, st_probe()
frees the buffer without freeing pointers, resulting in
a memory leak. Free page pointer array before freeing
the buffer on the probe error path.

Fixes: d0e1ae31be22 ("[SCSI] st: add struct rq_map_data support")
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
---
 drivers/scsi/st.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index e9d41e3cc2dd..77f4a66af2ec 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -4593,6 +4593,7 @@ static int st_probe(struct scsi_device *SDp)
 out_free_tape:
 	kfree(tpnt);
 out_buffer_free:
+	kfree(buffer->reserved_pages);
 	kfree(buffer);
 out:
 	scsi_autopm_put_device(SDp);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-02  4:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02  4:14 [PATCH] scsi: st: Free the reserved page array on probe failure Haoxiang Li
2026-12-02  4:19 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox