milos-linux/drivers/usb
HyeongJun An 96d47e40bf USB: serial: kl5kusb105: fix bulk-out buffer overflow
klsi_105_prepare_write_buffer() is called by the generic write path
with the bulk-out buffer and its size (bulk_out_size, 64 bytes). It
stores a two-byte length header at the start of the buffer and copies
the payload from the write fifo starting at buf + KLSI_HDR_LEN, but
passes the full buffer size as the number of bytes to copy:

  count = kfifo_out_locked(&port->write_fifo, buf + KLSI_HDR_LEN,
                           size, &port->lock);

When the fifo holds at least size bytes, size bytes are copied starting
two bytes into the size-byte buffer, writing KLSI_HDR_LEN bytes past its
end. Copy at most size - KLSI_HDR_LEN bytes instead, leaving room for
the header as safe_serial already does.

Writing bulk_out_size or more bytes to the tty triggers a slab
out-of-bounds write, observed with KASAN by emulating the device with
dummy_hcd and raw-gadget:

  BUG: KASAN: slab-out-of-bounds in kfifo_copy_out+0x83/0xc0
  Write of size 64 at addr ffff888112c62202 by task python3
   kfifo_copy_out
   klsi_105_prepare_write_buffer [kl5kusb105]
   usb_serial_generic_write_start [usbserial]
  Allocated by task 139:
   usb_serial_probe [usbserial]
  The buggy address is located 2 bytes inside of allocated 64-byte region

The out-of-bounds write no longer occurs with this change applied.

Fixes: 60b3013cda ("USB: kl5usb105: reimplement using generic framework")
Cc: stable@vger.kernel.org
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: HyeongJun An <sammiee5311@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
2026-06-08 13:43:10 +02:00
..
atm Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
c67x00 Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
cdns3 usb: cdns3: gadget: fix request skipping after clearing halt 2026-05-21 16:56:29 +02:00
chipidea usb: chipidea: core: convert ci_role_switch to local variable 2026-05-22 11:20:56 +02:00
class USB: cdc-acm: Fix bit overlap and move quirk definitions to header 2026-05-22 11:27:34 +02:00
common usb: ulpi: fix memory leak on ulpi_register() error paths 2026-04-27 09:49:43 -06:00
core USB: quirks: add NO_LPM for Lenovo ThinkPad USB-C Dock Gen2 hub controllers 2026-05-22 11:12:34 +02:00
dwc2 usb: dwc2: Fix use after free in debug code 2026-05-22 11:21:07 +02:00
dwc3 usb: dwc3: xilinx: fix error handling in zynqmp init error paths 2026-05-21 16:40:50 +02:00
early
fotg210 Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
gadget usb: gadget: f_fs: serialize DMABUF cancel against request completion 2026-05-22 11:20:43 +02:00
host xhci: tegra: Fix ghost USB device on dual-role port unplug 2026-05-22 10:35:50 +02:00
image Merge 7.0-rc4 into usb-next 2026-03-16 11:50:48 +01:00
isp1760 Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
misc Linux 7.0-rc7 2026-04-06 09:06:39 +02:00
mon Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
mtu3 Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
musb usb: musb: omap2430: Fix use-after-free in omap2430_probe() 2026-05-22 10:33:43 +02:00
phy Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
renesas_usbhs usb: renesas_usbhs: use kzalloc_flex 2026-03-18 15:51:48 +01:00
roles usb: roles: get usb role switch from parent only for usb-b-connector 2026-03-11 16:22:22 +01:00
serial USB: serial: kl5kusb105: fix bulk-out buffer overflow 2026-06-08 13:43:10 +02:00
storage usb: storage: Add quirks for PNY Elite Portable SSD 2026-05-22 11:12:47 +02:00
typec usb: typec: ucsi: Don't update power_supply on power role change if not connected 2026-05-21 16:57:15 +02:00
usbip usbip: vudc: Fix use after free bug in vudc_remove due to race condition 2026-05-22 11:13:06 +02:00
Kconfig
Makefile usb: isp1362-hcd: remove Philips ISP1362 USB OTG controller driver 2026-01-07 16:13:19 +01:00
usb-skeleton.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00