Re: [syzbot] Re: [syzbot] [can?] [usb?] KASAN: slab-out-of-bounds Read in ucan_probe

From: syzbot
Date: Wed Mar 26 2025 - 21:28:35 EST


For archival purposes, forwarding an incoming command email to
linux-kernel@xxxxxxxxxxxxxxx.

***

Subject: Re: [syzbot] [can?] [usb?] KASAN: slab-out-of-bounds Read in ucan_probe
Author: lizhi.xu@xxxxxxxxxxxxx

#syz test

diff --git a/drivers/net/can/usb/ucan.c b/drivers/net/can/usb/ucan.c
index 39a63b731..97c6cfa2d 100644
--- a/drivers/net/can/usb/ucan.c
+++ b/drivers/net/can/usb/ucan.c
@@ -1399,7 +1399,7 @@ static int ucan_probe(struct usb_interface *intf,

/* Prepare Memory for control transfers */
ctl_msg_buffer = devm_kzalloc(&udev->dev,
- sizeof(union ucan_ctl_payload),
+ sizeof(union ucan_ctl_payload) + 1,
GFP_KERNEL);
if (!ctl_msg_buffer) {
dev_err(&udev->dev,