* [PATCH 00/10] i2c: Fix Critical and High issues reported by Sashiko
@ 2026-12-03 18:31 Lee Jones
2026-12-03 18:31 ` [PATCH 04/10] i2c: omap: Check buf_len before buffer accesses in data transfer helpers Lee Jones
0 siblings, 1 reply; 2+ messages in thread
From: Lee Jones @ 2026-12-03 18:31 UTC (permalink / raw)
To: lee, Sumit Semwal, Christian König, Philipp Stanner,
linux-media, dri-devel, linaro-mm-sig
Cc: linux-kernel, Clément Le Goffic, Niklas Söderlund,
Aaro Koskinen, Akash Asthana, Alain Volmat, Alexandre Torgue,
Andi Shyti, Andreas Kemnade, Asmaa Mnebhi, Bakulchandra Shah,
Carlos Munoz, Carlos Song, Cedric Madianga, Dong Aisheng,
Elie Morisse, Fabio Estevam, Felipe Balbi, Frank Li, Gao Pan,
Greg Kroah-Hartman, Hans de Goede, Imre Deak, imx, Israel Cepeda,
Janusz Krzysztofik, Juha Yrjola, Kevin Hilman, Khalil Blaiech,
linux-arm-kernel, linux-arm-msm, linux-i2c, linux-omap,
linux-renesas-soc, linux-stm32, Maxime Coquelin,
Mukesh Kumar Savaliya, Nishant Menon, Pengutronix Kernel Team,
Pierre-Yves MORDRET, Piyush Malgujar, Robert Richter,
Roger Quadros, Roja Rani Yarubandi, Sakari Ailus, Sascha Hauer,
Shubhrajyoti D, Shyam Sundar S K, Siemens Networks,
Suneel Garapati, Syed Khasim, Tony Lindgren, Vadim Pasternak,
Vignesh R, Viken Dadhaniya, Wolfram Sang
These issues were reported by Sashiko.
Cc: "Clément Le Goffic" <clement.legoffic@foss.st.com>
Cc: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: Akash Asthana <akashast@codeaurora.org>
Cc: Alain Volmat <alain.volmat@foss.st.com>
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
Cc: Andi Shyti <andi.shyti@kernel.org>
Cc: Andreas Kemnade <andreas@kemnade.info>
Cc: Asmaa Mnebhi <asmaa@nvidia.com>
Cc: Bakulchandra Shah <Nehal-bakulchandra.shah@amd.com>
Cc: Carlos Munoz <carlos@kenati.com>
Cc: Carlos Song <carlos.song@nxp.com>
Cc: Cedric Madianga <cedric.madianga@gmail.com>
Cc: Dong Aisheng <aisheng.dong@nxp.com>
Cc: Elie Morisse <syniurge@gmail.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Frank Li <Frank.Li@nxp.com>
Cc: Gao Pan <pandy.gao@nxp.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Hans de Goede <hansg@kernel.org>
Cc: Imre Deak <imre.deak@nokia.com>
Cc: imx@lists.linux.dev
Cc: Israel Cepeda <israel.a.cepeda.lopez@intel.com>
Cc: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Cc: Juha Yrjola <juha.yrjola@solidboot.com>
Cc: Kevin Hilman <khilman@baylibre.com>
Cc: Khalil Blaiech <kblaiech@nvidia.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-arm-msm@vger.kernel.org
Cc: linux-i2c@vger.kernel.org
Cc: linux-media@vger.kernel.org
Cc: linux-omap@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org
Cc: linux-stm32@st-md-mailman.stormreply.com
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Mukesh Kumar Savaliya <mukesh.savaliya@oss.qualcomm.com>
Cc: Nishant Menon <nm@ti.com>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Pierre-Yves MORDRET <pierre-yves.mordret@foss.st.com>
Cc: Piyush Malgujar <pmalgujar@marvell.com>
Cc: Robert Richter <rric@kernel.org>
Cc: Roger Quadros <rogerq@kernel.org>
Cc: Roja Rani Yarubandi <rojay@codeaurora.org>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Shubhrajyoti D <shubhrajyoti@ti.com>
Cc: Shyam Sundar S K <shyam-sundar.s-k@amd.com>
Cc: Siemens Networks <michael.lawnick.ext@nsn.com>
Cc: Suneel Garapati <sgarapati@marvell.com>
Cc: Syed Khasim <x0khasim@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Vadim Pasternak <vadimp@mellanox.com>
Cc: Vignesh R <vigneshr@ti.com>
Cc: Viken Dadhaniya <viken.dadhaniya@oss.qualcomm.com>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
Lee Jones (10):
i2c: imx-lpi2c: Clear rx_cmd_buf pointer after freeing in
lpi2c_imx_dma_xfer()
i2c: qcom-geni: Clear dma_buf pointer after releasing DMA buffer
i2c: sh_mobile: Terminate DMA before freeing bounce buffer in
sh_mobile_xfer()
i2c: omap: Check buf_len before buffer accesses in data transfer
helpers
i2c: stm32f7: Prevent duplicate execution of
stm32f7_i2c_dma_callback()
i2c: stm32f7: Allocate smbus_buf separately for DMA safety
i2c: usbio: Validate full reply length in split-read loop
i2c: amd-mp2: Synchronise IRQ completion with command timeout
i2c: mlxbf: Reject zero-length SMBus reads to prevent stack overflow
i2c: octeon: Guard to_pci_dev() with dev_is_pci() in
octeon_i2c_set_clock()
drivers/i2c/busses/i2c-amd-mp2-pci.c | 29 ++++++++++++++----
drivers/i2c/busses/i2c-amd-mp2-plat.c | 5 ----
drivers/i2c/busses/i2c-amd-mp2.h | 3 ++
drivers/i2c/busses/i2c-imx-lpi2c.c | 4 ++-
drivers/i2c/busses/i2c-mlxbf.c | 8 +++++
drivers/i2c/busses/i2c-octeon-core.c | 3 +-
drivers/i2c/busses/i2c-omap.c | 14 ++++++---
drivers/i2c/busses/i2c-qcom-geni.c | 2 ++
drivers/i2c/busses/i2c-sh_mobile.c | 18 ++++++-----
drivers/i2c/busses/i2c-stm32f7.c | 43 ++++++++++++++++++++++-----
drivers/i2c/busses/i2c-usbio.c | 4 +--
11 files changed, 99 insertions(+), 34 deletions(-)
--
2.56.1.911.g883d8bcb20-goog
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 04/10] i2c: omap: Check buf_len before buffer accesses in data transfer helpers
2026-12-03 18:31 [PATCH 00/10] i2c: Fix Critical and High issues reported by Sashiko Lee Jones
@ 2026-12-03 18:31 ` Lee Jones
0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2026-12-03 18:31 UTC (permalink / raw)
To: lee, Vignesh R, Aaro Koskinen, Andreas Kemnade, Kevin Hilman,
Roger Quadros, Tony Lindgren, Janusz Krzysztofik, Andi Shyti,
Imre Deak, Juha Yrjola, Syed Khasim, Nishant Menon, Wolfram Sang,
Shubhrajyoti D, Felipe Balbi, linux-omap, linux-i2c
Cc: linux-kernel, stable
omap_i2c_receive_data() and omap_i2c_transmit_data() dereference
omap->buf without checking omap->buf_len. On controllers with
OMAP_I2C_FLAG_16BIT_DATA_REG, any odd-length message reads or writes
one byte past msg->buf and underflows omap->buf_len; FIFO counts
exceeding omap->buf_len also overflow the message buffer.
Guard all omap->buf accesses and omap->buf_len decrements against a
zero remaining length, matching omap_i2c_omap1_isr().
Fixes: dd74548ddece ("i2c: omap: resize fifos before each message")
Closes: https://sashiko.dev/#/bug/linux-288ca65a-55c7-4651-8d27-2629e158106e
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/i2c/busses/i2c-omap.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 6a577db3cb64..4684e0d64cff 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1003,14 +1003,17 @@ static void omap_i2c_receive_data(struct omap_i2c_dev *omap, u8 num_bytes,
while (num_bytes--) {
w = omap_i2c_read_reg(omap, OMAP_I2C_DATA_REG);
- *omap->buf++ = w;
- omap->buf_len--;
+ if (omap->buf_len) {
+ *omap->buf++ = w;
+ omap->buf_len--;
+ }
/*
* Data reg in 2430, omap3 and
* omap4 is 8 bit wide
*/
- if (omap->flags & OMAP_I2C_FLAG_16BIT_DATA_REG) {
+ if ((omap->flags & OMAP_I2C_FLAG_16BIT_DATA_REG) &&
+ omap->buf_len) {
*omap->buf++ = w >> 8;
omap->buf_len--;
}
@@ -1023,6 +1026,8 @@ static int omap_i2c_transmit_data(struct omap_i2c_dev *omap, u8 num_bytes,
u16 w;
while (num_bytes--) {
+ if (!omap->buf_len)
+ break;
w = *omap->buf++;
omap->buf_len--;
@@ -1030,7 +1035,8 @@ static int omap_i2c_transmit_data(struct omap_i2c_dev *omap, u8 num_bytes,
* Data reg in 2430, omap3 and
* omap4 is 8 bit wide
*/
- if (omap->flags & OMAP_I2C_FLAG_16BIT_DATA_REG) {
+ if ((omap->flags & OMAP_I2C_FLAG_16BIT_DATA_REG) &&
+ omap->buf_len) {
w |= *omap->buf++ << 8;
omap->buf_len--;
}
--
2.56.1.911.g883d8bcb20-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-03 18:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 04/10] i2c: omap: Check buf_len before buffer accesses in data transfer helpers Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox