Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: mctp-i2c: fix duplicate reception of old data

The MCTP I2C slave callback did not handle I2C_SLAVE_READ_REQUESTED
events. As a result, i2c read event will trigger repeated reception of
old data, reset rx_pos when a read request is received.

Signed-off-by: Jian Zhang <zhangjian.3032@bytedance.com>
Link: https://patch.msgid.link/20260108101829.1140448-1-zhangjian.3032@bytedance.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Jian Zhang and committed by
Jakub Kicinski
ae4744e1 aab8aa1b

+6
+6
drivers/net/mctp/mctp-i2c.c
··· 242 242 return 0; 243 243 244 244 switch (event) { 245 + case I2C_SLAVE_READ_REQUESTED: 246 + midev->rx_pos = 0; 247 + break; 245 248 case I2C_SLAVE_WRITE_RECEIVED: 246 249 if (midev->rx_pos < MCTP_I2C_BUFSZ) { 247 250 midev->rx_buffer[midev->rx_pos] = *val; ··· 281 278 u8 pec, calc_pec; 282 279 size_t recvlen; 283 280 int status; 281 + 282 + if (midev->rx_pos == 0) 283 + return 0; 284 284 285 285 /* + 1 for the PEC */ 286 286 if (midev->rx_pos < MCTP_I2C_MINLEN + 1) {