linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Johan Hovold <johan@kernel.org>
Cc: syzbot <syzbot+72af3105289dcb4c055b@syzkaller.appspotmail.com>,
	gregkh@linuxfoundation.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 12:14:45 -0400	[thread overview]
Message-ID: <20210712161445.GA321728@rowland.harvard.edu> (raw)
In-Reply-To: <YOxk0URZrLYv8SNU@hovoldconsulting.com>

On Mon, Jul 12, 2021 at 05:50:41PM +0200, Johan Hovold wrote:
> On Mon, Jul 12, 2021 at 05:29:20PM +0200, Johan Hovold wrote:
> > On Mon, Jul 12, 2021 at 10:00:04AM -0400, Alan Stern wrote:
> > > 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
> 
> > > 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?
> > 
> > Did syzbot actually test the patch? I can't see how the direction bit of
> > the pipe argument can be set with the above applied either.
> 
> It looks like the second patch you submitted was hand-edited and still
> quoted.
> 
> And looking at the dashboard it seems like no patch was applied for your
> second test attempt:
> 
> 	https://syzkaller.appspot.com/bug?extid=72af3105289dcb4c055b

Yes, that explains it.  Funny how easy it is to miss those "> " 
markings -- you just get too used to them.

> I've been bitten by something like this before when erroneously thinking
> that a test command could be submitted as a reply to a patch.
> 
> Perhaps the report mail could include the patch tested or something so
> we don't spend time investigating syzbot interface failures.

Good idea.

Anyway, here's the patch again, this time properly formatted.  Hopefully 
now it will work.

Alan Stern


#syz test: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git ee268dee

Index: usb-devel/drivers/usb/core/devio.c
===================================================================
--- 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);
 

  reply	other threads:[~2021-07-12 16:14 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
2021-07-12 15:29         ` Johan Hovold
2021-07-12 15:50           ` Johan Hovold
2021-07-12 16:14             ` Alan Stern [this message]
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=20210712161445.GA321728@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).