[syzbot] WARNING in __usbnet_read_cmd/usb_submit_urb

7 views
Skip to first unread message

syzbot

unread,
Jan 6, 2023, 9:52:47ā€ÆAM1/6/23
to gre...@linuxfoundation.org, linux-...@vger.kernel.org, linu...@vger.kernel.org, mailhol...@wanadoo.fr, m...@pengutronix.de, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 1b929c02afd3 Linux 6.2-rc1
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
console output: https://syzkaller.appspot.com/x/log.txt?x=128acc94480000
kernel config: https://syzkaller.appspot.com/x/.config?x=19062640e84d2e8f
dashboard link: https://syzkaller.appspot.com/bug?extid=2a0e7abd24f1eb90ce25
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/22dc9b4a71a2/disk-1b929c02.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/3a88668bf3ce/vmlinux-1b929c02.xz
kernel image: https://storage.googleapis.com/syzbot-assets/3ff0c2e45492/bzImage-1b929c02.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+2a0e7a...@syzkaller.appspotmail.com

------------[ cut here ]------------
usb 3-1: BOGUS control dir, pipe 80003d80 doesn't match bRequestType c0
WARNING: CPU: 1 PID: 2386 at drivers/usb/core/urb.c:411 usb_submit_urb+0x14a3/0x1880 drivers/usb/core/urb.c:411
Modules linked in:
CPU: 1 PID: 2386 Comm: dhcpcd Not tainted 6.2.0-rc1-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
RIP: 0010:usb_submit_urb+0x14a3/0x1880 drivers/usb/core/urb.c:411
Code: 7c 24 40 e8 8f af 8b fd 48 8b 7c 24 40 e8 e5 2c 19 ff 45 89 e8 44 89 f1 4c 89 e2 48 89 c6 48 c7 c7 00 df aa 86 e8 5b e6 15 02 <0f> 0b e9 9f ee ff ff e8 61 af 8b fd 0f b6 1d 89 5f 18 05 31 ff 41
RSP: 0018:ffffc9000147f598 EFLAGS: 00010286
RAX: 0000000000000000 RBX: ffff888118cdc058 RCX: 0000000000000000
RDX: ffff888116045400 RSI: ffffffff812d3e48 RDI: fffff5200028fea5
RBP: ffff888108e1cf78 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffff88810dcc37a8
R13: 00000000000000c0 R14: 0000000080003d80 R15: ffff88810b3e5600
FS: 00007f22d5f1d740(0000) GS:ffff8881f6900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f54a3e45440 CR3: 0000000112062000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
usb_start_wait_urb+0x101/0x4b0 drivers/usb/core/message.c:58
usb_internal_control_msg drivers/usb/core/message.c:102 [inline]
usb_control_msg+0x31c/0x4a0 drivers/usb/core/message.c:153
__usbnet_read_cmd+0xb9/0x390 drivers/net/usb/usbnet.c:2010
usbnet_read_cmd+0x92/0xf0 drivers/net/usb/usbnet.c:2068
pl_vendor_req drivers/net/usb/plusb.c:60 [inline]
pl_set_QuickLink_features drivers/net/usb/plusb.c:75 [inline]
pl_reset+0x2b/0xf0 drivers/net/usb/plusb.c:85
usbnet_open+0xc8/0x5d0 drivers/net/usb/usbnet.c:889
__dev_open+0x297/0x4d0 net/core/dev.c:1417
__dev_change_flags+0x583/0x750 net/core/dev.c:8530
dev_change_flags+0x93/0x170 net/core/dev.c:8602
devinet_ioctl+0x1601/0x1ce0 net/ipv4/devinet.c:1147
inet_ioctl+0x1e6/0x320 net/ipv4/af_inet.c:979
sock_do_ioctl+0xcc/0x230 net/socket.c:1169
sock_ioctl+0x2f1/0x640 net/socket.c:1286
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:870 [inline]
__se_sys_ioctl fs/ioctl.c:856 [inline]
__x64_sys_ioctl+0x193/0x200 fs/ioctl.c:856
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f22d600b0e7
Code: 3c 1c e8 1c ff ff ff 85 c0 79 87 49 c7 c4 ff ff ff ff 5b 5d 4c 89 e0 41 5c c3 66 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 61 9d 0c 00 f7 d8 64 89 01 48
RSP: 002b:00007ffc78c609f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f22d5f1d6c8 RCX: 00007f22d600b0e7
RDX: 00007ffc78c70be8 RSI: 0000000000008914 RDI: 0000000000000005
RBP: 00007ffc78c80d98 R08: 00007ffc78c70ba8 R09: 00007ffc78c70b58
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffc78c70be8 R14: 0000000000000028 R15: 0000000000008914
</TASK>


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

Alan Stern

unread,
Jan 6, 2023, 12:33:25ā€ÆPM1/6/23
to syzbot, Jakub Kicinski, Oliver Neukum, gre...@linuxfoundation.org, linux-...@vger.kernel.org, linu...@vger.kernel.org, mailhol...@wanadoo.fr, m...@pengutronix.de, syzkall...@googlegroups.com
On Fri, Jan 06, 2023 at 06:52:45AM -0800, syzbot wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 1b929c02afd3 Linux 6.2-rc1
> git tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
> console output: https://syzkaller.appspot.com/x/log.txt?x=128acc94480000
> kernel config: https://syzkaller.appspot.com/x/.config?x=19062640e84d2e8f
> dashboard link: https://syzkaller.appspot.com/bug?extid=2a0e7abd24f1eb90ce25
> compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
>
> Unfortunately, I don't have any reproducer for this issue yet.

I don't know why not; the bug is easily repeatable.

> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/22dc9b4a71a2/disk-1b929c02.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/3a88668bf3ce/vmlinux-1b929c02.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/3ff0c2e45492/bzImage-1b929c02.xz
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+2a0e7a...@syzkaller.appspotmail.com
>
> ------------[ cut here ]------------
> usb 3-1: BOGUS control dir, pipe 80003d80 doesn't match bRequestType c0
> WARNING: CPU: 1 PID: 2386 at drivers/usb/core/urb.c:411 usb_submit_urb+0x14a3/0x1880 drivers/usb/core/urb.c:411

> Call Trace:
> <TASK>
> usb_start_wait_urb+0x101/0x4b0 drivers/usb/core/message.c:58
> usb_internal_control_msg drivers/usb/core/message.c:102 [inline]
> usb_control_msg+0x31c/0x4a0 drivers/usb/core/message.c:153
> __usbnet_read_cmd+0xb9/0x390 drivers/net/usb/usbnet.c:2010
> usbnet_read_cmd+0x92/0xf0 drivers/net/usb/usbnet.c:2068
> pl_vendor_req drivers/net/usb/plusb.c:60 [inline]

This is obviously a bug in plusb.c. The code is:

static inline int
pl_vendor_req(struct usbnet *dev, u8 req, u8 val, u8 index)
{
return usbnet_read_cmd(dev, req,
USB_DIR_IN | USB_TYPE_VENDOR |
USB_RECIP_DEVICE,
val, index, NULL, 0);
}

Since the transfer length is 0 this should be a write, not a read. The
USB_DIR_IN value shouldn't be present, and the call should be to
usbnet_write_cmd().

There's a similar mistake in __usbnet_read_cmd(). The routine tests for
zero-length transfers, but when it finds one it merely avoids allocating
a transfer buffer instead of warning about a programming bug.

Alan Stern

syzbot

unread,
Feb 2, 2023, 4:06:46ā€ÆAM2/2/23
to gre...@linuxfoundation.org, ku...@kernel.org, linux-...@vger.kernel.org, linu...@vger.kernel.org, mailhol...@wanadoo.fr, m...@pengutronix.de, one...@suse.com, st...@rowland.harvard.edu, syzkall...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 9f266ccaa2f5 Merge tag 'for_linus' of git://git.kernel.org..
git tree: upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=103b6ea5480000
kernel config: https://syzkaller.appspot.com/x/.config?x=94f93727847d4d81
dashboard link: https://syzkaller.appspot.com/bug?extid=2a0e7abd24f1eb90ce25
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=13c8afb3480000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14bebfb5480000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/710b69f64bd2/disk-9f266cca.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/f155d6966517/vmlinux-9f266cca.xz
kernel image: https://storage.googleapis.com/syzbot-assets/07672b7ba2df/bzImage-9f266cca.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+2a0e7a...@syzkaller.appspotmail.com

------------[ cut here ]------------
usb 1-1: BOGUS control dir, pipe 80000280 doesn't match bRequestType c0
WARNING: CPU: 0 PID: 4645 at drivers/usb/core/urb.c:411 usb_submit_urb+0x14a7/0x1880 drivers/usb/core/urb.c:411
Modules linked in:
CPU: 1 PID: 4645 Comm: dhcpcd Not tainted 6.2.0-rc6-syzkaller-00050-g9f266ccaa2f5 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023
RIP: 0010:usb_submit_urb+0x14a7/0x1880 drivers/usb/core/urb.c:411
Code: 7c 24 40 e8 ab 4c 80 fb 48 8b 7c 24 40 e8 71 14 01 ff 45 89 e8 44 89 f1 4c 89 e2 48 89 c6 48 c7 c7 20 b0 fa 8a e8 d3 ab be 03 <0f> 0b e9 9f ee ff ff e8 7d 4c 80 fb 0f b6 1d 17 b2 5c 08 31 ff 41
RSP: 0018:ffffc9000355f5a0 EFLAGS: 00010282
RAX: 0000000000000000 RBX: ffff888017d2c058 RCX: 0000000000000000
RDX: ffff88801f901d40 RSI: ffffffff816680ec RDI: fffff520006abea6
RBP: ffff88801cc501e0 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000080000000 R11: 0000000000000000 R12: ffff888017a92d98
R13: 00000000000000c0 R14: 0000000080000280 R15: ffff888017a25200
FS: 00007f2a38e6d740(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f2f3dabf300 CR3: 0000000021a8d000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
usb_start_wait_urb+0x101/0x4b0 drivers/usb/core/message.c:58
usb_internal_control_msg drivers/usb/core/message.c:102 [inline]
usb_control_msg+0x320/0x4a0 drivers/usb/core/message.c:153
__usbnet_read_cmd+0xb9/0x390 drivers/net/usb/usbnet.c:2010
usbnet_read_cmd+0x96/0xf0 drivers/net/usb/usbnet.c:2068
pl_vendor_req drivers/net/usb/plusb.c:60 [inline]
pl_set_QuickLink_features drivers/net/usb/plusb.c:75 [inline]
pl_reset+0x2f/0xf0 drivers/net/usb/plusb.c:85
usbnet_open+0xcc/0x5d0 drivers/net/usb/usbnet.c:889
__dev_open+0x297/0x4d0 net/core/dev.c:1417
__dev_change_flags+0x587/0x750 net/core/dev.c:8530
dev_change_flags+0x97/0x170 net/core/dev.c:8602
devinet_ioctl+0x15a2/0x1d70 net/ipv4/devinet.c:1147
inet_ioctl+0x33f/0x380 net/ipv4/af_inet.c:979
sock_do_ioctl+0xcc/0x230 net/socket.c:1169
sock_ioctl+0x1f8/0x680 net/socket.c:1286
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:870 [inline]
__se_sys_ioctl fs/ioctl.c:856 [inline]
__x64_sys_ioctl+0x197/0x210 fs/ioctl.c:856
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f2a38f5b0e7
Code: 3c 1c e8 1c ff ff ff 85 c0 79 87 49 c7 c4 ff ff ff ff 5b 5d 4c 89 e0 41 5c c3 66 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 61 9d 0c 00 f7 d8 64 89 01 48
RSP: 002b:00007ffd77152e38 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f2a38e6d6c8 RCX: 00007f2a38f5b0e7
RDX: 00007ffd77163028 RSI: 0000000000008914 RDI: 0000000000000018
RBP: 00007ffd771731d8 R08: 00007ffd77162fe8 R09: 00007ffd77162f98
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffd77163028 R14: 0000000000000028 R15: 0000000000008914
</TASK>

Alan Stern

unread,
Feb 2, 2023, 3:49:55ā€ÆPM2/2/23
to syzbot, gre...@linuxfoundation.org, ku...@kernel.org, linux-...@vger.kernel.org, linu...@vger.kernel.org, mailhol...@wanadoo.fr, m...@pengutronix.de, one...@suse.com, syzkall...@googlegroups.com
A zero-length USB transfer is a write, not a read.

Alan Stern

#syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/ 9f266ccaa2f5

Index: usb-devel/drivers/net/usb/plusb.c
===================================================================
--- usb-devel.orig/drivers/net/usb/plusb.c
+++ usb-devel/drivers/net/usb/plusb.c
@@ -57,9 +57,7 @@
static inline int
pl_vendor_req(struct usbnet *dev, u8 req, u8 val, u8 index)
{
- return usbnet_read_cmd(dev, req,
- USB_DIR_IN | USB_TYPE_VENDOR |
- USB_RECIP_DEVICE,
+ return usbnet_write_cmd(dev, req, USB_TYPE_VENDOR | USB_RECIP_DEVICE,
val, index, NULL, 0);
}

syzbot

unread,
Feb 2, 2023, 4:16:29ā€ÆPM2/2/23
to gre...@linuxfoundation.org, ku...@kernel.org, linux-...@vger.kernel.org, linu...@vger.kernel.org, mailhol...@wanadoo.fr, m...@pengutronix.de, one...@suse.com, st...@rowland.harvard.edu, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+2a0e7a...@syzkaller.appspotmail.com

Tested on:

commit: 9f266cca Merge tag 'for_linus' of git://git.kernel.org..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
console output: https://syzkaller.appspot.com/x/log.txt?x=157cfe31480000
kernel config: https://syzkaller.appspot.com/x/.config?x=94f93727847d4d81
dashboard link: https://syzkaller.appspot.com/bug?extid=2a0e7abd24f1eb90ce25
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
patch: https://syzkaller.appspot.com/x/patch.diff?x=173ddea5480000

Note: testing is done by a robot and is best-effort only.

Alan Stern

unread,
Feb 3, 2023, 2:32:11ā€ÆPM2/3/23
to Greg KH, syzbot, ku...@kernel.org, linux-...@vger.kernel.org, linu...@vger.kernel.org, net...@vger.kernel.org, mailhol...@wanadoo.fr, m...@pengutronix.de, one...@suse.com, syzkall...@googlegroups.com
The syzbot fuzzer detected a bug in the plusb network driver: A
zero-length control-OUT transfer was treated as a read instead of a
write. In modern kernels this error provokes a WARNING:

usb 1-1: BOGUS control dir, pipe 80000280 doesn't match bRequestType c0
WARNING: CPU: 0 PID: 4645 at drivers/usb/core/urb.c:411
usb_submit_urb+0x14a7/0x1880 drivers/usb/core/urb.c:411
Modules linked in:
CPU: 1 PID: 4645 Comm: dhcpcd Not tainted
6.2.0-rc6-syzkaller-00050-g9f266ccaa2f5 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google
01/12/2023
RIP: 0010:usb_submit_urb+0x14a7/0x1880 drivers/usb/core/urb.c:411
...
The fix is to call usbnet_write_cmd() instead of usbnet_read_cmd() and
remove the USB_DIR_IN flag.

Reported-and-tested-by: syzbot+2a0e7a...@syzkaller.appspotmail.com
Signed-off-by: Alan Stern <st...@rowland.harvard.edu>
Fixes: 090ffa9d0e90 ("[PATCH] USB: usbnet (9/9) module for pl2301/2302 cables")
CC: sta...@vger.kernel.org
Link: https://lore.kernel.org/r/00000000000052...@google.com/

---


[as1991]

patchwork-b...@kernel.org

unread,
Feb 6, 2023, 5:14:00ā€ÆAM2/6/23
to Alan Stern, gre...@linuxfoundation.org, syzbot+2a0e7a...@syzkaller.appspotmail.com, ku...@kernel.org, linux-...@vger.kernel.org, linu...@vger.kernel.org, net...@vger.kernel.org, mailhol...@wanadoo.fr, m...@pengutronix.de, one...@suse.com, syzkall...@googlegroups.com
Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <da...@davemloft.net>:
> [...]

Here is the summary with links:
- net: USB: Fix wrong-direction WARNING in plusb.c
https://git.kernel.org/netdev/net/c/811d581194f7

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html


Reply all
Reply to author
Forward
0 new messages