linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: Peter Chen <Peter.Chen@freescale.com>
Cc: "balbi@ti.com" <balbi@ti.com>,
	Tapasweni Pathak <tapaswenipathak@gmail.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"jg1.han@samsung.com" <jg1.han@samsung.com>,
	"benoit.taine@lip6.fr" <benoit.taine@lip6.fr>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"julia.lawall@lip6.fr" <julia.lawall@lip6.fr>
Subject: Re: [PATCH] drivers: usb: gadget: udc: Fix NULL dereference
Date: Mon, 9 Mar 2015 21:36:23 -0500	[thread overview]
Message-ID: <20150310023623.GA31214@saruman.tx.rr.com> (raw)
In-Reply-To: <BN3PR0301MB0849AD8FBBB71F287C72B9D581180@BN3PR0301MB0849.namprd03.prod.outlook.com>

[-- Attachment #1: Type: text/plain, Size: 1202 bytes --]

On Tue, Mar 10, 2015 at 02:02:44AM +0000, Peter Chen wrote:
>  
> > > --- a/drivers/usb/gadget/udc/lpc32xx_udc.c
> > > +++ b/drivers/usb/gadget/udc/lpc32xx_udc.c
> > > @@ -1803,7 +1803,7 @@ static int lpc32xx_ep_queue(struct usb_ep *_ep,
> > >  	req = container_of(_req, struct lpc32xx_request, req);
> > >  	ep = container_of(_ep, struct lpc32xx_ep, ep);
> > >
> > > -	if (!_req || !_req->complete || !_req->buf ||
> > > +	if (!_ep || !_req || !_req->complete || !_req->buf ||
> > >  	    !list_empty(&req->queue))
> > >  		return -EINVAL;
> > >
> > > @@ -1815,8 +1815,7 @@ static int lpc32xx_ep_queue(struct usb_ep *_ep,
> > >  	}
> > >
> > >
> > > -	if ((!udc) || (!udc->driver) ||
> > > -	    (udc->gadget.speed == USB_SPEED_UNKNOWN)) {
> > > +	if ((!udc->driver) || (udc->gadget.speed == USB_SPEED_UNKNOWN))
> > {
> > >  		dev_dbg(udc->dev, "invalid device\n");
> > >  		return -EINVAL;
> > >  	}
> > 
> > what's going to happen here ?
> > 
> 
> I just changed the current code, in fact, udc->driver is impossible to NULL which
> is cleared at .udc_stop. 
> 
> The speed is possible for unknown if the reset has occurred at that time.

oh, alright.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-03-10  2:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-03 12:58 [PATCH] drivers: usb: gadget: udc: Fix NULL dereference Tapasweni Pathak
2015-03-04  1:11 ` Peter Chen
2015-03-09 15:41   ` Felipe Balbi
2015-03-10  2:02     ` Peter Chen
2015-03-10  2:36       ` Felipe Balbi [this message]
2015-03-10  3:00         ` Peter Chen
2015-03-10 20:50           ` Felipe Balbi

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=20150310023623.GA31214@saruman.tx.rr.com \
    --to=balbi@ti.com \
    --cc=Peter.Chen@freescale.com \
    --cc=benoit.taine@lip6.fr \
    --cc=gregkh@linuxfoundation.org \
    --cc=jg1.han@samsung.com \
    --cc=julia.lawall@lip6.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=tapaswenipathak@gmail.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).