* [PATCH v2] USB: serial: io_ti: reject oversized boot-mode firmware
@ 2026-07-20 11:48 Pengpeng Hou
2026-07-20 14:39 ` Johan Hovold
0 siblings, 1 reply; 2+ messages in thread
From: Pengpeng Hou @ 2026-07-20 11:48 UTC (permalink / raw)
To: Johan Hovold; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel, Pengpeng Hou
do_boot_mode() copies the firmware payload, excluding its four-byte prefix,
into a fixed 15.5 KiB staging buffer. check_fw_sanity() already proves that
the image contains its seven-byte header and validates the declared image
length and checksum, but it does not impose this boot-mode destination
limit.
Reject images whose payload does not fit before allocating and filling the
staging buffer.
Fixes: d12b219a228e ("edgeport-ti: use request_firmware()")
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
Changes since v1: https://lore.kernel.org/all/20260701053535.39951-1-pengpeng@iscas.ac.cn/
- drop the redundant short-image check already provided by check_fw_sanity()
- state that the issue was found by source review
- add the requested Fixes tag
- rebase onto v7.2-rc4
drivers/usb/serial/io_ti.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index 07c0eff3bef4..cc28f5869a3e 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -1464,6 +1464,12 @@ static int do_boot_mode(struct edgeport_serial *serial,
/* Allocate a 15.5k buffer + 3 byte header */
buffer_size = (((1024 * 16) - 512) +
sizeof(struct ti_i2c_image_header));
+ if (fw->size - 4 > buffer_size) {
+ dev_err(dev, "%s - firmware image is too large\n",
+ __func__);
+ return -EINVAL;
+ }
+
buffer = kmalloc(buffer_size, GFP_KERNEL);
if (!buffer)
return -ENOMEM;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] USB: serial: io_ti: reject oversized boot-mode firmware
2026-07-20 11:48 [PATCH v2] USB: serial: io_ti: reject oversized boot-mode firmware Pengpeng Hou
@ 2026-07-20 14:39 ` Johan Hovold
0 siblings, 0 replies; 2+ messages in thread
From: Johan Hovold @ 2026-07-20 14:39 UTC (permalink / raw)
To: Pengpeng Hou; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel
On Mon, Jul 20, 2026 at 07:48:17PM +0800, Pengpeng Hou wrote:
> do_boot_mode() copies the firmware payload, excluding its four-byte prefix,
> into a fixed 15.5 KiB staging buffer. check_fw_sanity() already proves that
> the image contains its seven-byte header and validates the declared image
> length and checksum, but it does not impose this boot-mode destination
> limit.
>
> Reject images whose payload does not fit before allocating and filling the
> staging buffer.
>
> Fixes: d12b219a228e ("edgeport-ti: use request_firmware()")
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---
> Changes since v1: https://lore.kernel.org/all/20260701053535.39951-1-pengpeng@iscas.ac.cn/
> - drop the redundant short-image check already provided by check_fw_sanity()
> - state that the issue was found by source review
> - add the requested Fixes tag
> - rebase onto v7.2-rc4
Applied, thanks.
Johan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-20 14:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-20 11:48 [PATCH v2] USB: serial: io_ti: reject oversized boot-mode firmware Pengpeng Hou
2026-07-20 14:39 ` Johan Hovold
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®