* [PATCH] scsi: 53c700: fix invalid frees in m68k driver remove paths
@ 2026-11-22 16:04 Ziheng Wei
2026-11-23 8:21 ` Geert Uytterhoeven
2026-11-26 3:26 ` Martin K. Petersen
0 siblings, 2 replies; 3+ 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 [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi: 53c700: fix invalid frees in m68k driver remove paths
2026-11-22 16:04 [PATCH] scsi: 53c700: fix invalid frees in m68k driver remove paths Ziheng Wei
@ 2026-11-23 8:21 ` Geert Uytterhoeven
2026-11-26 3:26 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2026-11-23 8:21 UTC (permalink / raw)
To: Ziheng Wei
Cc: James E . J . Bottomley, Martin K . Petersen, linux-scsi,
linux-m68k, linux-kernel, stable, Kars de Jong
CC Kars
On Sun, 22 Nov 2026 at 17:05, Ziheng Wei <zihengw03@163.com> wrote:
> 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>
LGTM, so
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi: 53c700: fix invalid frees in m68k driver remove paths
2026-11-22 16:04 [PATCH] scsi: 53c700: fix invalid frees in m68k driver remove paths Ziheng Wei
2026-11-23 8:21 ` Geert Uytterhoeven
@ 2026-11-26 3:26 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2026-11-26 3:26 UTC (permalink / raw)
To: Ziheng Wei
Cc: James E . J . Bottomley, Martin K . Petersen, linux-scsi,
linux-m68k, linux-kernel, stable
Ziheng,
> 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.
Applied to 7.5/scsi-staging, thanks!
--
Martin K. Petersen
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-26 3:26 UTC | newest]
Thread overview: 3+ 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-23 8:21 ` Geert Uytterhoeven
2026-11-26 3:26 ` 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®