From: Antti Laakso <antti.laakso@linux.intel.com>
To: Lee Jones <lee@kernel.org>
Cc: israel.a.cepeda.lopez@intel.com, hansg@kernel.org,
sakari.ailus@linux.intel.com, andi.shyti@kernel.org,
gregkh@linuxfoundation.org, wsa+renesas@sang-engineering.com,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH 7/10] i2c: usbio: Validate full reply length in split-read loop
Date: Fri, 4 Dec 2026 18:53:03 +0200 [thread overview]
Message-ID: <axLv7--ooI1r-es8@alaakso-desk> (raw)
In-Reply-To: <20261203183214.1939736-8-lee@kernel.org>
On Thu, Dec 03, 2026 at 06:31:11PM +0000, Lee Jones wrote:
> In usbio_i2c_read(), the split-read loop checks only whether
> usbio_bulk_msg() returned a negative error code before copying rxchunk
> bytes from rbuf->data into msg->buf. On a short USB bulk reply, stale
> bytes remaining in the reused i2c->rwbuf buffer are copied into
> msg->buf and leaked to callers.
>
> Validate that usbio_bulk_msg() returns exactly sizeof(*rbuf) + rxchunk,
> matching the non-split path.
>
> Fixes: daf161343a39 ("i2c: Add Intel USBIO I2C driver")
> Closes: https://sashiko.dev/#/bug/linux-68c6624e-612b-4fc9-94f7-ecb3df8ff838
> Cc: stable@vger.kernel.org
> Signed-off-by: Lee Jones <lee@kernel.org>
> ---
Tested-by: Antti Laakso <antti.laakso@linux.intel.com>
> drivers/i2c/busses/i2c-usbio.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-usbio.c b/drivers/i2c/busses/i2c-usbio.c
> index 12a4154860a4..063577cc0ddf 100644
> --- a/drivers/i2c/busses/i2c-usbio.c
> +++ b/drivers/i2c/busses/i2c-usbio.c
> @@ -103,8 +103,8 @@ static int usbio_i2c_read(struct i2c_adapter *adap, struct i2c_msg *msg)
> USBIO_I2CCMD_READ, true,
> rbuf, len == 0 ? sizeof(*rbuf) : 0,
> rbuf, sizeof(*rbuf) + rxchunk);
> - if (ret < 0)
> - return ret;
> + if (ret != sizeof(*rbuf) + rxchunk)
> + return (ret < 0) ? ret : -EIO;
>
> memcpy(&msg->buf[len], rbuf->data, rxchunk);
> len += rxchunk;
> --
> 2.56.1.911.g883d8bcb20-goog
next prev parent reply other threads:[~2026-12-04 16:53 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 18:31 [PATCH 00/10] i2c: Fix Critical and High issues reported by Sashiko Lee Jones
2026-12-03 18:31 ` [PATCH 01/10] i2c: imx-lpi2c: Clear rx_cmd_buf pointer after freeing in lpi2c_imx_dma_xfer() Lee Jones
2026-12-03 20:36 ` Frank Li
2026-12-04 10:33 ` Peng Fan (OSS)
2026-12-03 18:31 ` [PATCH 02/10] i2c: qcom-geni: Clear dma_buf pointer after releasing DMA buffer Lee Jones
2026-12-03 18:31 ` [PATCH 03/10] i2c: sh_mobile: Terminate DMA before freeing bounce buffer in sh_mobile_xfer() Lee Jones
2026-12-03 18:31 ` [PATCH 04/10] i2c: omap: Check buf_len before buffer accesses in data transfer helpers Lee Jones
2026-12-03 22:00 ` Andreas Kemnade
2026-12-03 18:31 ` [PATCH 05/10] i2c: stm32f7: Prevent duplicate execution of stm32f7_i2c_dma_callback() Lee Jones
2026-12-03 18:31 ` [PATCH 06/10] i2c: stm32f7: Allocate smbus_buf separately for DMA safety Lee Jones
2026-12-03 18:31 ` [PATCH 07/10] i2c: usbio: Validate full reply length in split-read loop Lee Jones
2026-12-04 16:53 ` Antti Laakso [this message]
2026-12-04 21:07 ` Sakari Ailus
2026-12-03 18:31 ` [PATCH 08/10] i2c: amd-mp2: Synchronise IRQ completion with command timeout Lee Jones
2026-12-03 18:31 ` [PATCH 09/10] i2c: mlxbf: Reject zero-length SMBus reads to prevent stack overflow Lee Jones
2026-12-03 18:31 ` [PATCH 10/10] i2c: octeon: Guard to_pci_dev() with dev_is_pci() in octeon_i2c_set_clock() Lee Jones
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=axLv7--ooI1r-es8@alaakso-desk \
--to=antti.laakso@linux.intel.com \
--cc=andi.shyti@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=hansg@kernel.org \
--cc=israel.a.cepeda.lopez@intel.com \
--cc=lee@kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=stable@vger.kernel.org \
--cc=wsa+renesas@sang-engineering.com \
/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
all inboxes | Powered by JetHome®