lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20260113-mctp-read-fix-v1-1-70c4b59c741c@codeconstruct.com.au>
Date: Tue, 13 Jan 2026 17:01:16 +0800
From: Matt Johnston <matt@...econstruct.com.au>
To: Jeremy Kerr <jk@...econstruct.com.au>, 
 Andrew Lunn <andrew+netdev@...n.ch>, 
 "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, 
 Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, 
 Wolfram Sang <wsa@...nel.org>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org, 
 Andrew Jeffery <andrew@...econstruct.com.au>, 
 Matt Johnston <matt@...econstruct.com.au>
Subject: [PATCH net-next] mctp i2c: initialise event handler read bytes

Set a 0xff value for i2c reads of an mctp-i2c device. Otherwise reads
will return "val" from the i2c bus driver. For i2c-aspeed and
i2c-npcm7xx that is a stack uninitialised u8.

Tested with "i2ctransfer -y 1 r10@...4" where 0x34 is a mctp-i2c
instance, now it returns all 0xff.

Fixes: f5b8abf9fc3d ("mctp i2c: MCTP I2C binding driver")
Signed-off-by: Matt Johnston <matt@...econstruct.com.au>
---
I'm targeting net-next since this depends on the just-committed fix
from Jian Zhang 
ae4744e173fa ("net: mctp-i2c: fix duplicate reception of old data")

That patch and this one should both be applied to stable - will that
happen automatically with "Fixes:"?

Thanks,
Matt
---
 drivers/net/mctp/mctp-i2c.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/mctp/mctp-i2c.c b/drivers/net/mctp/mctp-i2c.c
index ecda1cc36391ce50a6b28e6a9e13c3b344f8f993..8043b57bdf25095b3b4e6bacd3abbc6f8952acfe 100644
--- a/drivers/net/mctp/mctp-i2c.c
+++ b/drivers/net/mctp/mctp-i2c.c
@@ -243,7 +243,10 @@ static int mctp_i2c_slave_cb(struct i2c_client *client,
 
 	switch (event) {
 	case I2C_SLAVE_READ_REQUESTED:
+	case I2C_SLAVE_READ_PROCESSED:
+		/* MCTP I2C transport only uses writes */
 		midev->rx_pos = 0;
+		*val = 0xff;
 		break;
 	case I2C_SLAVE_WRITE_RECEIVED:
 		if (midev->rx_pos < MCTP_I2C_BUFSZ) {

---
base-commit: f10c325a345fef0a688a2bcdfab1540d1c924148
change-id: 20260113-mctp-read-fix-e191357ad049
prerequisite-message-id: <20260108101829.1140448-1-zhangjian.3032@...edance.com>
prerequisite-patch-id: 0765450364f2e9f65f6f3940d4a45598763aae8c

Best regards,
-- 
Matt Johnston <matt@...econstruct.com.au>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ