Re: [syzbot] KMSAN: kernel-infoleak in iowarrior_read
From: syzbot
Date: Thu Sep 12 2024 - 14:47:14 EST
For archival purposes, forwarding an incoming command email to
linux-kernel@xxxxxxxxxxxxxxx.
***
Subject: KMSAN: kernel-infoleak in iowarrior_read
Author: djahchankoike@xxxxxxxxx
#syz test
iowarrior_callback may send uninitialized data if memcpy fails
copying data from urb to read_queue, check if memcpy is successful
before waking waiting readers.
Signed-off-by: Diogo Jahchan Koike <djahchankoike@xxxxxxxxx>
---
drivers/usb/misc/iowarrior.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c
index 6d28467ce352..6f5cd6251d76 100644
--- a/drivers/usb/misc/iowarrior.c
+++ b/drivers/usb/misc/iowarrior.c
@@ -201,8 +201,9 @@ static void iowarrior_callback(struct urb *urb)
/* +1 for serial number */
offset = intr_idx * (dev->report_size + 1);
- memcpy(dev->read_queue + offset, urb->transfer_buffer,
- dev->report_size);
+ if (!memcpy(dev->read_queue + offset, urb->transfer_buffer,
+ dev->report_size))
+ goto exit;
*(dev->read_queue + offset + (dev->report_size)) = dev->serial_number++;
atomic_set(&dev->intr_idx, aux_idx);
--
2.43.0