All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 5.10] scsi: gdth: ensure event string is NUL-terminated
@ 2026-08-19  9:35 Daniil Iskhakov
  2026-08-21  4:33 ` Sasha Levin
  0 siblings, 1 reply; 2+ messages in thread
From: Daniil Iskhakov @ 2026-08-19  9:35 UTC (permalink / raw)
  To: stable, Greg Kroah-Hartman
  Cc: Daniil Iskhakov, Achim Leubner, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel, Agalakov Daniil,
	Roman Razov, lvc-project

No upstream commit exists for this patch. GDT driver was removed from
kernel in commit 0653c358d2dc ("scsi: Drop gdth driver").

For GDT_PCIMPR controllers, the driver copies up to 256 bytes from the
controller event buffer and later handles the result as a C string.

If the firmware does not provide a NUL byte within the buffer,
gdth_log_event() may read beyond event_string through printk() and
sprintf().

Force the last byte of event_string to NUL after copying it from the
controller. This preserves shorter strings and safely truncates an
unterminated full-length event.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Co-developed-by: Agalakov Daniil <ade@amicon.ru>
Signed-off-by: Agalakov Daniil <ade@amicon.ru>
Signed-off-by: Daniil Iskhakov <dish@amicon.ru>
---
 drivers/scsi/gdth.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 5d801388680b..744fc1bf1855 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -2562,6 +2562,7 @@ static irqreturn_t __gdth_interrupt(gdth_ha_str *ha,
                         if (ha->dvr.event_string[i] == 0)
                             break;
                     }
+                    ha->dvr.event_string[255] = 0;
                 }
             }
             writeb(0xff, &dp6m_ptr->i960r.edoor_reg);
-- 
2.43.0

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

* Re: [PATCH 5.10] scsi: gdth: ensure event string is NUL-terminated
  2026-08-19  9:35 [PATCH 5.10] scsi: gdth: ensure event string is NUL-terminated Daniil Iskhakov
@ 2026-08-21  4:33 ` Sasha Levin
  0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2026-08-21  4:33 UTC (permalink / raw)
  To: stable, Greg Kroah-Hartman
  Cc: Sasha Levin, Daniil Iskhakov, Achim Leubner, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel, Agalakov Daniil,
	Roman Razov, lvc-project

> No upstream commit exists for this patch. GDT driver was removed from
> kernel in commit 0653c358d2dc ("scsi: Drop gdth driver").
[...]
> Found by Linux Verification Center (linuxtesting.org) with SVACE.

Since this driver has been gone for the past few years, a maintainer ack will
be appreciated before we pull this in.

Does anyone even care?

-- 
Thanks,
Sasha

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

end of thread, other threads:[~2026-08-21  4:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-19  9:35 [PATCH 5.10] scsi: gdth: ensure event string is NUL-terminated Daniil Iskhakov
2026-08-21  4:33 ` Sasha Levin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.