linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: syzbot <syzbot+72af3105289dcb4c055b@syzkaller.appspotmail.com>
Cc: gregkh@linuxfoundation.org, johan@kernel.org,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	mathias.nyman@linux.intel.com, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] WARNING in do_proc_control/usb_submit_urb
Date: Mon, 12 Jul 2021 10:00:04 -0400	[thread overview]
Message-ID: <20210712140004.GA316776@rowland.harvard.edu> (raw)
In-Reply-To: <00000000000068b24405c6db3249@google.com>

On Sun, Jul 11, 2021 at 09:07:09AM -0700, syzbot wrote:
> Hello,
> 
> syzbot has tested the proposed patch but the reproducer is still triggering an issue:
> WARNING in do_proc_control/usb_submit_urb
> 
> ------------[ cut here ]------------
> usb usb2: BOGUS control dir, pipe 80000180 doesn't match bRequestType 80
> WARNING: CPU: 0 PID: 10164 at drivers/usb/core/urb.c:410 usb_submit_urb+0x149d/0x18a0 drivers/usb/core/urb.c:410
> Modules linked in:
> CPU: 1 PID: 10164 Comm: syz-executor.2 Tainted: G        W         5.13.0-next-20210707-syzkaller #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
> RIP: 0010:usb_submit_urb+0x149d/0x18a0 drivers/usb/core/urb.c:410
> Code: 7c 24 40 e8 45 1e 20 fc 48 8b 7c 24 40 e8 6b 40 0c ff 45 89 e8 44 89 f1 4c 89 e2 48 89 c6 48 c7 c7 a0 99 27 8a e8 5a a4 91 03 <0f> 0b e9 a5 ee ff ff e8 17 1e 20 fc 0f b6 1d 21 86 02 08 31 ff 41
> RSP: 0018:ffffc9000a33f9a8 EFLAGS: 00010286
> RAX: 0000000000000000 RBX: ffff8881468f1058 RCX: 0000000000000000
> RDX: ffff88802a830000 RSI: ffffffff815d7735 RDI: fffff52001467f27
> RBP: ffff888142fe0578 R08: 0000000000000000 R09: 0000000000000000
> R10: ffffffff815d156e R11: 0000000000000000 R12: ffff888146811500
> R13: 0000000000000080 R14: 0000000080000180 R15: ffff8880135f2700
> FS:  00007f1b9bc83700(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
> CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 00007ffcfa7f3720 CR3: 000000003de67000 CR4: 00000000001506e0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> Call Trace:
>  usb_start_wait_urb+0x101/0x4c0 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
>  do_proc_control+0x6c4/0x920 drivers/usb/core/devio.c:1141
>  proc_control drivers/usb/core/devio.c:1191 [inline]
>  usbdev_do_ioctl drivers/usb/core/devio.c:2540 [inline]
>  usbdev_ioctl+0x10e2/0x36c0 drivers/usb/core/devio.c:2713

I don't get this.  It shouldn't be possible.  The fact that the 
direction bit is set in both bRequestType and pipe means that the URB 
was submitted as a control-IN but had length 0.  But the patch addresses 
exactly that case:

--- usb-devel.orig/drivers/usb/core/devio.c
+++ usb-devel/drivers/usb/core/devio.c
@@ -1133,7 +1133,7 @@ static int do_proc_control(struct usb_de
 		"wIndex=%04x wLength=%04x\n",
 		ctrl->bRequestType, ctrl->bRequest, ctrl->wValue,
 		ctrl->wIndex, ctrl->wLength);
-	if (ctrl->bRequestType & 0x80) {
+	if ((ctrl->bRequestType & USB_DIR_IN) && ctrl->wLength) {
 		pipe = usb_rcvctrlpipe(dev, 0);
 		snoop_urb(dev, NULL, pipe, ctrl->wLength, tmo, SUBMIT, NULL, 0);
 
and causes the kernel to handle it as a control-OUT instead.

Johan, any ideas?

Alan Stern


  reply	other threads:[~2021-07-12 14:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-10 11:11 [syzbot] WARNING in do_proc_control/usb_submit_urb syzbot
2021-07-10 14:50 ` Alan Stern
2021-07-10 22:58   ` syzbot
2021-07-11  0:36     ` Alan Stern
2021-07-11 15:53   ` Alan Stern
2021-07-11 16:07     ` syzbot
2021-07-12 14:00       ` Alan Stern [this message]
2021-07-12 15:29         ` Johan Hovold
2021-07-12 15:50           ` Johan Hovold
2021-07-12 16:14             ` Alan Stern
2021-07-12 16:24               ` Dmitry Vyukov
2021-07-12 18:48                 ` Alan Stern
2021-07-15  7:19                   ` Dmitry Vyukov
2021-07-12 16:32               ` syzbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210712140004.GA316776@rowland.harvard.edu \
    --to=stern@rowland.harvard.edu \
    --cc=gregkh@linuxfoundation.org \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@linux.intel.com \
    --cc=syzbot+72af3105289dcb4c055b@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).