Linux USB
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Adrian Korwel <adriank20047@gmail.com>
Cc: linux-usb@vger.kernel.org, gregkh@linuxfoundation.org,
	stable@vger.kernel.org
Subject: Re: [PATCH 1/2] USB: serial: io_ti: fix heap overflow in get_manuf_info()
Date: Tue, 2 Jun 2026 12:17:51 +0200	[thread overview]
Message-ID: <ah6tz1s90zvxaPef@hovoldconsulting.com> (raw)
In-Reply-To: <20260525145832.2941-1-adriank20047@gmail.com>

On Mon, May 25, 2026 at 09:58:31AM -0500, Adrian Korwel wrote:
> 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 to fit
> within TI_MAX_I2C_SIZE (16384 bytes),

get_descriptor_addr() does not validate this, but apparently
check_i2c_image() has already done so. I added a comment about that
since it's not obvious.

> not against the destination
> buffer size. A malicious USB device can therefore set Size to any
> value up to 16383, causing a heap overflow of up to 16373 bytes
> when plugged into a host running this driver.

You also need to account for the first two bytes and the header so these
numbers should be 16377 and 16367, right?
 
> valid_csum() is called after read_rom() and also iterates
> buffer[0..Size-1], compounding the out-of-bounds access.
> 
> Fix by rejecting descriptors larger than the destination struct
> before calling read_rom().

We should also make sure that the descriptor is not too short so I
amended the patch when applying.

End result is here:

	https://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial.git/commit/?h=usb-linus&id=183c1076eca43bbb3e7bdf597456f91d81c73e74

> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Cc: stable@vger.kernel.org
> Signed-off-by: Adrian Korwel <adriank20047@gmail.com>

Both fixes now applied, thanks.

Johan

      parent reply	other threads:[~2026-06-02 10:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-25  2:20 [PATCH] USB: serial: io_ti: fix heap overflows in get_manuf_info() and build_i2c_fw_hdr() Adrian Korwel
2026-05-25  5:57 ` Greg KH
2026-05-25 14:41   ` Adrian Korwel
2026-05-25 14:58   ` [PATCH 1/2] USB: serial: io_ti: fix heap overflow in get_manuf_info() Adrian Korwel
2026-05-25 14:58     ` [PATCH 2/2] USB: serial: io_ti: fix heap overflow in build_i2c_fw_hdr() Adrian Korwel
2026-06-02 10:17     ` Johan Hovold [this message]

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=ah6tz1s90zvxaPef@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=adriank20047@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox