From: Daniil Iskhakov <dish@amicon.ru>
To: <stable@vger.kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Daniil Iskhakov <dish@amicon.ru>,
Achim Leubner <achim_leubner@adaptec.com>,
"James E.J. Bottomley" <jejb@linux.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
<linux-scsi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Agalakov Daniil <ade@amicon.ru>, Roman Razov <rrv@amicon.ru>,
<lvc-project@linuxtesting.org>
Subject: [PATCH 5.10] scsi: gdth: ensure event string is NUL-terminated
Date: Wed, 19 Aug 2026 12:35:20 +0300 [thread overview]
Message-ID: <20260819093542.23409-1-dish@amicon.ru> (raw)
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
next reply other threads:[~2026-08-19 9:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-19 9:35 Daniil Iskhakov [this message]
2026-08-21 4:33 ` [PATCH 5.10] scsi: gdth: ensure event string is NUL-terminated Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260819093542.23409-1-dish@amicon.ru \
--to=dish@amicon.ru \
--cc=achim_leubner@adaptec.com \
--cc=ade@amicon.ru \
--cc=gregkh@linuxfoundation.org \
--cc=jejb@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=martin.petersen@oracle.com \
--cc=rrv@amicon.ru \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.