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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241004123313.2463701-1-bemenboshra2001@gmail.com>
Date: Fri,  4 Oct 2024 12:33:13 +0000
From: Pimyn@....codeaurora.org, Girgis@....codeaurora.org,
	bemenboshra2001@...il.com
To: gregkh@...uxfoundation.org
Cc: linux-kernel@...r.kernel.org,
	linux-usb@...r.kernel.org,
	syzkaller-bugs@...glegroups.com,
	nogikh@...gle.com,
	glider@...gle.com,
	dvyukov@...gle.com,
	elver@...gle.com,
	pimyn@...gle.com,
	syzbot+8f282cce71948071c335@...kaller.appspotmail.com,
	Pimyn Girgis <bemenboshra2001@...il.com>
Subject: [PATCH] usb: usbtmc: initialize memory written to device

Avoid kernel-usb-infoleak by initializing all memory written to device.
The buffer length uses 32bit alignment which might cause some buffer
data to be read without any initialization.

Reported-by: syzbot+8f282cce71948071c335@...kaller.appspotmail.com
Closes: https://lore.kernel.org/all/0000000000006f6622061eb52dba@google.com/T/
Signed-off-by: Pimyn Girgis <bemenboshra2001@...il.com> (Google)
---
 drivers/usb/class/usbtmc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index ffc9c6fdd7e1..d79a08dfb54d 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -21,6 +21,7 @@
 #include <linux/usb.h>
 #include <linux/compat.h>
 #include <linux/usb/tmc.h>
+#include <linux/string.h>
 
 /* Increment API VERSION when changing tmc.h with new flags or ioctls
  * or when changing a significant behavior of the driver.
@@ -1169,6 +1170,8 @@ static ssize_t usbtmc_generic_write(struct usbtmc_file_data *file_data,
 		 * (size + 3 & ~3) rounds up and simplifies user code
 		 */
 		aligned = (this_part + 3) & ~3;
+		/* Initialize the remaining part of the buffer */
+		memzero_explicit(buffer + this_part, aligned - this_part);
 		dev_dbg(dev, "write(size:%u align:%u done:%u)\n",
 			(unsigned int)this_part,
 			(unsigned int)aligned,
-- 
2.47.0.rc0.187.ge670bccf7e-goog


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ