* [PATCH v2 0/1] i2c: mv64xxx: prevent illegal pointer access
@ 2025-08-03 10:15 enachman
2025-08-03 10:15 ` [PATCH v2 1/1] " enachman
2025-08-03 15:04 ` [PATCH v2 0/1] " Markus Elfring
0 siblings, 2 replies; 4+ messages in thread
From: enachman @ 2025-08-03 10:15 UTC (permalink / raw)
To: gregory.clement, andi.shyti, linux-i2c, linux-kernel; +Cc: enachman
From: Elad Nachman <enachman@marvell.com>
v2:
1) rewrap commit message
Elad Nachman (1):
i2c: mv64xxx: prevent illegal pointer access
drivers/i2c/busses/i2c-mv64xxx.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/1] i2c: mv64xxx: prevent illegal pointer access
2025-08-03 10:15 [PATCH v2 0/1] i2c: mv64xxx: prevent illegal pointer access enachman
@ 2025-08-03 10:15 ` enachman
2025-08-03 15:11 ` [PATCH v2] " Markus Elfring
2025-08-03 15:04 ` [PATCH v2 0/1] " Markus Elfring
1 sibling, 1 reply; 4+ messages in thread
From: enachman @ 2025-08-03 10:15 UTC (permalink / raw)
To: gregory.clement, andi.shyti, linux-i2c, linux-kernel; +Cc: enachman
From: Elad Nachman <enachman@marvell.com>
Spurious interrupts left while i2c controller still at RX or TX state
would try to access the RX or TX buffer pointer, which is NULL.
Add check to verify buffer pointer is not NULL before reading or writing
the buffer for additional TX or RX operations.
Signed-off-by: Elad Nachman <enachman@marvell.com>
---
drivers/i2c/busses/i2c-mv64xxx.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index 8fc26a511320..e6baa9c520b4 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -390,14 +390,18 @@ mv64xxx_i2c_do_action(struct mv64xxx_i2c_data *drv_data)
break;
case MV64XXX_I2C_ACTION_SEND_DATA:
- writel(drv_data->msg->buf[drv_data->byte_posn++],
- drv_data->reg_base + drv_data->reg_offsets.data);
+ if (drv_data->msg && drv_data->msg->buf)
+ writel(drv_data->msg->buf[drv_data->byte_posn++],
+ drv_data->reg_base + drv_data->reg_offsets.data);
writel(drv_data->cntl_bits,
drv_data->reg_base + drv_data->reg_offsets.control);
break;
case MV64XXX_I2C_ACTION_RCV_DATA:
- drv_data->msg->buf[drv_data->byte_posn++] =
+ if (drv_data->msg && drv_data->msg->buf)
+ drv_data->msg->buf[drv_data->byte_posn++] =
+ readl(drv_data->reg_base + drv_data->reg_offsets.data);
+ else
readl(drv_data->reg_base + drv_data->reg_offsets.data);
writel(drv_data->cntl_bits,
drv_data->reg_base + drv_data->reg_offsets.control);
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 0/1] i2c: mv64xxx: prevent illegal pointer access
2025-08-03 10:15 [PATCH v2 0/1] i2c: mv64xxx: prevent illegal pointer access enachman
2025-08-03 10:15 ` [PATCH v2 1/1] " enachman
@ 2025-08-03 15:04 ` Markus Elfring
1 sibling, 0 replies; 4+ messages in thread
From: Markus Elfring @ 2025-08-03 15:04 UTC (permalink / raw)
To: Elad Nachman, linux-i2c; +Cc: LKML, Andi Shyti, Gregory Clement
…
> v2:
> 1) rewrap commit message
…
You may omit a cover letter for a single patch,
don't you?
Regards,
Markus
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-08-03 15:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-03 10:15 [PATCH v2 0/1] i2c: mv64xxx: prevent illegal pointer access enachman
2025-08-03 10:15 ` [PATCH v2 1/1] " enachman
2025-08-03 15:11 ` [PATCH v2] " Markus Elfring
2025-08-03 15:04 ` [PATCH v2 0/1] " Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox