Skip to content

Commit 0f744cb

Browse files
CIQ Kernel Automationbmastbergen
authored andcommitted
USB: serial: io_ti: fix heap overflow in get_manuf_info()
jira VULN-189703 cve CVE-2026-53196 commit-author Adrian Korwel <adriank20047@gmail.com> commit 183c107 get_manuf_info() reads le16_to_cpu(rom_desc->Size) bytes from the device I2C EEPROM into a buffer allocated with kmalloc_obj(), which is sizeof(struct edge_ti_manuf_descriptor) = 10 bytes. The Size field comes from the device and is only validated (in check_i2c_image()) to make sure the descriptor fits within TI_MAX_I2C_SIZE (16384 bytes), not against the destination buffer size. A malicious USB device can therefore set Size to any value up to 16377, causing a heap overflow of up to 16367 bytes when plugged into a host running this driver. valid_csum() is called after read_rom() and also iterates buffer[0..Size-1], compounding the out-of-bounds access. Fix by rejecting descriptors with unexpected length before calling read_rom(). Fixes: 1da177e ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Signed-off-by: Adrian Korwel <adriank20047@gmail.com> [ johan: amend commit message; also check for short descriptors ] Signed-off-by: Johan Hovold <johan@kernel.org> (cherry picked from commit 183c107) Signed-off-by: CIQ Kernel Automation <ciq_kernel_automation@ciq.com>
1 parent dc8bf4f commit 0f744cb

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

drivers/usb/serial/io_ti.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,12 @@ static int get_manuf_info(struct edgeport_serial *serial, u8 *buffer)
770770
}
771771

772772
/* Read the descriptor data */
773+
if (le16_to_cpu(rom_desc->Size) != sizeof(struct edge_ti_manuf_descriptor)) {
774+
dev_err(dev, "unexpected Edge descriptor length: %u\n",
775+
le16_to_cpu(rom_desc->Size));
776+
status = -EINVAL;
777+
goto exit;
778+
}
773779
status = read_rom(serial, start_address+sizeof(struct ti_i2c_desc),
774780
le16_to_cpu(rom_desc->Size), buffer);
775781
if (status)

0 commit comments

Comments
 (0)