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: <20250609053507.10628-1-abhinav.ogl@gmail.com>
Date: Mon,  9 Jun 2025 11:05:08 +0530
From: Abhinav Ananthu <abhinav.ogl@...il.com>
To: wsa+renesas@...g-engineering.com
Cc: linux-i2c@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	syzbot+0a36c1fec090c67a9885@...kaller.appspotmail.com,
	Abhinav Ananthu <abhinav.ogl@...il.com>
Subject: [PATCH] i2c: core: Fix uninit-value in i2c_smbus_xfer_emulated

BUG: KMSAN: uninit-value in i2c_smbus_xfer_emulated drivers/i2c/i2c-core-smbus.c:481 [inline]
BUG: KMSAN: uninit-value in __i2c_smbus_xfer+0x23e7/0x2f60

KMSAN reported an uninitialized value access in i2c_smbus_xfer_emulated at
drivers/i2c/i2c-core-smbus.c:481, triggered during an SMBus transfer via
i2cdev_ioctl_smbus. The issue occurs because the local buffers msgbuf0 and
msgbuf1 are not initialized before use, leading to potential undefined
behavior when their contents are accessed.

Initialize msgbuf0 and msgbuf1 with zeros using memset to ensure all buffer
contents are defined before they are used in the SMBus transfer. This
prevents the uninitialized value access reported by KMSAN.

Reported-by: syzbot+0a36c1fec090c67a9885@...kaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=0a36c1fec090c67a9885
Fixes: 02ddfb981de8 ("KMSAN : Fix uninit-value in i2c_smbus_xfer_emulated")
Signed-off-by: Abhinav Ananthu <abhinav.ogl@...il.com>
---
 drivers/i2c/i2c-core-smbus.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/i2c/i2c-core-smbus.c b/drivers/i2c/i2c-core-smbus.c
index e73afbefe222..a3ee30b72f75 100644
--- a/drivers/i2c/i2c-core-smbus.c
+++ b/drivers/i2c/i2c-core-smbus.c
@@ -332,6 +332,8 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter *adapter, u16 addr,
 	 */
 	unsigned char msgbuf0[I2C_SMBUS_BLOCK_MAX+3];
 	unsigned char msgbuf1[I2C_SMBUS_BLOCK_MAX+2];
+	memset(msgbuf0, 0, sizeof(msgbuf0));
+	memset(msgbuf1, 0, sizeof(msgbuf1));
 	int nmsgs = read_write == I2C_SMBUS_READ ? 2 : 1;
 	u8 partial_pec = 0;
 	int status;
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ