* [PATCH] scsi: mptspi: Fix reference count leak in mptspi_write_spi_device_pg1
@ 2025-03-18 10:17 Miaoqian Lin
0 siblings, 0 replies; only message in thread
From: Miaoqian Lin @ 2025-03-18 10:17 UTC (permalink / raw)
To: Sathya Prakash, Sreekanth Reddy, Suganath Prabu Subramani,
Kashyap, Desai, James Bottomley, MPT-FusionLinux.pdl, linux-scsi,
linux-kernel
Cc: linmq006
scsi_device_lookup_by_target() returns a reference that needs to be
released with scsi_device_put(). Add missing scsi_device_put() before
continue.
Fixes: 19fff154e7ee ("[SCSI] mptfusion: Adding inline data padding support for TAPE drive.")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
drivers/message/fusion/mptspi.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c
index a3901fbfac4f..14b7c1d841a4 100644
--- a/drivers/message/fusion/mptspi.c
+++ b/drivers/message/fusion/mptspi.c
@@ -908,14 +908,19 @@ static int mptspi_write_spi_device_pg1(struct scsi_target *starget,
/* Turn on inline data padding for TAPE when running U320 */
for (i = 0 ; i < 16; i++) {
sdev = scsi_device_lookup_by_target(starget, i);
- if (sdev && sdev->type == TYPE_TAPE) {
+ if (!sdev)
+ continue;
+
+ if (sdev->type == TYPE_TAPE) {
sdev_printk(KERN_DEBUG, sdev, MYIOC_s_FMT
"IDP:ON\n", ioc->name);
nego_parms |= MPI_SCSIDEVPAGE1_RP_IDP;
pg1->RequestedParameters =
cpu_to_le32(nego_parms);
+ scsi_device_put(sdev);
break;
}
+ scsi_device_put(sdev);
}
}
--
2.39.5 (Apple Git-154)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-03-18 10:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-18 10:17 [PATCH] scsi: mptspi: Fix reference count leak in mptspi_write_spi_device_pg1 Miaoqian Lin
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®