From: Greg KH <greg@kroah.com>
To: "Gopal, Saranya" <saranya.gopal@intel.com>
Cc: "stable@vger.kernel.org" <stable@vger.kernel.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"Yang, Fei" <fei.yang@intel.com>,
"john.stultz@linaro.org" <john.stultz@linaro.org>,
Felipe Balbi <felipe.balbi@linux.intel.com>
Subject: Re: [PATCH 4.19.y 2/3] usb: dwc3: gadget: prevent dwc3_request from being queued twice
Date: Mon, 29 Jul 2019 19:28:20 +0200 [thread overview]
Message-ID: <20190729172820.GA17093@kroah.com> (raw)
In-Reply-To: <C672AA6DAAC36042A98BAD0B0B25BDA94CC82DDD@BGSMSX104.gar.corp.intel.com>
On Mon, Jul 29, 2019 at 05:06:13PM +0000, Gopal, Saranya wrote:
> > On Mon, Jul 29, 2019 at 07:13:38PM +0530, Saranya Gopal wrote:
> > > From: Felipe Balbi <felipe.balbi@linux.intel.com>
> > >
> > > [Upstream commit b2b6d601365a1acb90b87c85197d79]
> > >
> > > Queueing the same request twice can introduce hard-to-debug
> > > problems. At least one function driver - Android's f_mtp.c - is known
> > > to cause this problem.
> > >
> > > While that function is out-of-tree, this is a problem that's easy
> > > enough to avoid.
> > >
> > > Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
> > > Signed-off-by: Saranya Gopal <saranya.gopal@intel.com>
> > > ---
> > > drivers/usb/dwc3/gadget.c | 5 +++++
> > > 1 file changed, 5 insertions(+)
> > >
> > > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> > > index 3f337a0..a56a92a 100644
> > > --- a/drivers/usb/dwc3/gadget.c
> > > +++ b/drivers/usb/dwc3/gadget.c
> > > @@ -1291,6 +1291,11 @@ static int __dwc3_gadget_ep_queue(struct
> > dwc3_ep *dep, struct dwc3_request *req)
> > > &req->request, req->dep->name))
> > > return -EINVAL;
> > >
> > > + if (WARN(req->status < DWC3_REQUEST_STATUS_COMPLETED,
> > > + "%s: request %pK already in flight\n",
> > > + dep->name, &req->request))
> > > + return -EINVAL;
> >
> > So we are going to trip syzbot up on this out-of-tree driver? Brave...
>
> I had retained the commit message from the upstream commit.
> However, without this patch, I see issues with adb as well.
> Adb will hang after adb root/unroot command and needs a reboot to recover.
So you see huge WARN dumps in the log?
That's fine, but be aware, if userspace can trigger this, then syzbot
will trigger it, and any system running 'panic on warn' will crash.
If this is something that we normally have to catch and handle, WARN()
is not how to do it. But we should fix that upstream, not here.
thanks,
greg k-h
next prev parent reply other threads:[~2019-07-29 17:28 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-29 13:43 [PATCH 4.19.y 0/3] usb: dwc3: Prevent requests from being queued twice Saranya Gopal
2019-07-29 13:43 ` [PATCH 4.19.y 1/3] usb: dwc3: gadget: add dwc3_request status tracking Saranya Gopal
2019-07-29 13:43 ` [PATCH 4.19.y 2/3] usb: dwc3: gadget: prevent dwc3_request from being queued twice Saranya Gopal
2019-07-29 16:56 ` Greg KH
2019-07-29 17:06 ` Gopal, Saranya
2019-07-29 17:28 ` Greg KH [this message]
2019-07-29 13:43 ` [PATCH 4.19.y 3/3] usb: dwc3: gadget: remove req->started flag Saranya Gopal
2019-07-29 16:56 ` Greg KH
2019-07-29 16:59 ` Gopal, Saranya
2019-07-29 17:34 ` [PATCH 4.19.y 0/3] usb: dwc3: Prevent requests from being queued twice Greg KH
2019-07-30 9:29 ` Gopal, Saranya
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=20190729172820.GA17093@kroah.com \
--to=greg@kroah.com \
--cc=fei.yang@intel.com \
--cc=felipe.balbi@linux.intel.com \
--cc=john.stultz@linaro.org \
--cc=linux-usb@vger.kernel.org \
--cc=saranya.gopal@intel.com \
--cc=stable@vger.kernel.org \
/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).