Linux SCSI subsystem development
 help / color / mirror / Atom feed
* [PATCH] scsi: 53c700: fix invalid frees in m68k driver remove paths
@ 2026-11-22 16:04 Ziheng Wei
  2026-11-22 16:14 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Ziheng Wei @ 2026-11-22 16:04 UTC (permalink / raw)
  To: James E . J . Bottomley, Martin K . Petersen
  Cc: linux-scsi, linux-m68k, linux-kernel, stable

NCR_700_detect() stores the allocated host parameters in
host->hostdata[0]. The m68k remove paths instead use shost_priv(host),
which returns the address of the pointer slot and causes an interior free.

Free the pointer stored in host->hostdata[0], as the other 53c700 drivers
do.

Found by LLM-assisted static analysis. Cross-compiled for m68k; no
runtime test on the affected hardware.

Fixes: a16efc1cbf0a ("[SCSI] 53c700: Amiga 4000T NCR53c710 SCSI")
Fixes: 8276b58af4dd ("[SCSI] 53c700: m68k BVME6000 NCR53C710 SCSI")
Fixes: 506c7bbcd9bc ("[SCSI] 53c700: m68k MVME16x NCR53C710 SCSI")
Fixes: 45804fbb00ee ("[SCSI] 53c700: Amiga Zorro NCR53c710 SCSI")
Cc: stable@vger.kernel.org
Signed-off-by: Ziheng Wei <zihengw03@163.com>
---
 drivers/scsi/a4000t.c        | 3 ++-
 drivers/scsi/bvme6000_scsi.c | 3 ++-
 drivers/scsi/mvme16x_scsi.c  | 3 ++-
 drivers/scsi/zorro7xx.c      | 3 ++-
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/a4000t.c b/drivers/scsi/a4000t.c
index a02638b47..e35df140a 100644
--- a/drivers/scsi/a4000t.c
+++ b/drivers/scsi/a4000t.c
@@ -97,7 +97,8 @@ static int __init amiga_a4000t_scsi_probe(struct platform_device *pdev)
 static void __exit amiga_a4000t_scsi_remove(struct platform_device *pdev)
 {
 	struct Scsi_Host *host = platform_get_drvdata(pdev);
-	struct NCR_700_Host_Parameters *hostdata = shost_priv(host);
+	struct NCR_700_Host_Parameters *hostdata =
+		(struct NCR_700_Host_Parameters *)host->hostdata[0];
 	struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
 	scsi_remove_host(host);
diff --git a/drivers/scsi/bvme6000_scsi.c b/drivers/scsi/bvme6000_scsi.c
index 23301edf1..4054f788d 100644
--- a/drivers/scsi/bvme6000_scsi.c
+++ b/drivers/scsi/bvme6000_scsi.c
@@ -93,7 +93,8 @@ static void
 bvme6000_device_remove(struct platform_device *dev)
 {
 	struct Scsi_Host *host = platform_get_drvdata(dev);
-	struct NCR_700_Host_Parameters *hostdata = shost_priv(host);
+	struct NCR_700_Host_Parameters *hostdata =
+		(struct NCR_700_Host_Parameters *)host->hostdata[0];
 
 	scsi_remove_host(host);
 	NCR_700_release(host);
diff --git a/drivers/scsi/mvme16x_scsi.c b/drivers/scsi/mvme16x_scsi.c
index f4db93c13..ba458c1a5 100644
--- a/drivers/scsi/mvme16x_scsi.c
+++ b/drivers/scsi/mvme16x_scsi.c
@@ -106,7 +106,8 @@ static int mvme16x_probe(struct platform_device *dev)
 static void mvme16x_device_remove(struct platform_device *dev)
 {
 	struct Scsi_Host *host = platform_get_drvdata(dev);
-	struct NCR_700_Host_Parameters *hostdata = shost_priv(host);
+	struct NCR_700_Host_Parameters *hostdata =
+		(struct NCR_700_Host_Parameters *)host->hostdata[0];
 
 	/* Disable scsi chip ints */
 	{
diff --git a/drivers/scsi/zorro7xx.c b/drivers/scsi/zorro7xx.c
index 894756326..6ec60deb7 100644
--- a/drivers/scsi/zorro7xx.c
+++ b/drivers/scsi/zorro7xx.c
@@ -161,7 +161,8 @@ static int zorro7xx_init_one(struct zorro_dev *z,
 static void zorro7xx_remove_one(struct zorro_dev *z)
 {
 	struct Scsi_Host *host = zorro_get_drvdata(z);
-	struct NCR_700_Host_Parameters *hostdata = shost_priv(host);
+	struct NCR_700_Host_Parameters *hostdata =
+		(struct NCR_700_Host_Parameters *)host->hostdata[0];
 
 	scsi_remove_host(host);
 

base-commit: 97d73c8251226cf27cc6656b4c542869bb8c69fa
-- 
2.43.0


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

end of thread, other threads:[~2026-11-22 16:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-22 16:04 [PATCH] scsi: 53c700: fix invalid frees in m68k driver remove paths Ziheng Wei
2026-11-22 16:14 ` sashiko-bot

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