[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_9909BBF933FF9E791B784B591B1525EDBA08@qq.com>
Date: Fri, 6 Sep 2024 20:37:53 +0800
From: Edward Adam Davis <eadavis@...com>
To: syzbot+9d34f80f841e948c3fdb@...kaller.appspotmail.com
Cc: linux-kernel@...r.kernel.org,
syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] [usb?] KMSAN: kernel-usb-infoleak in usbtmc_write
Clear the buffer that has not been set, after copying data from user space.
#syz test
diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index 6bd9fe565385..faf8c5508997 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -1591,6 +1591,10 @@ static ssize_t usbtmc_write(struct file *filp, const char __user *buf,
goto exit;
}
+ if (aligned < buflen)
+ memset(&buffer[USBTMC_HEADER_SIZE + transfersize], 0,
+ aligned - USBTMC_HEADER_SIZE - transfersize);
+
dev_dbg(&data->intf->dev, "%s(size:%u align:%u)\n", __func__,
(unsigned int)transfersize, (unsigned int)aligned);
Powered by blists - more mailing lists