All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bin Liu <b-liu@ti.com>
To: Tal Shorer <tal.shorer@gmail.com>
Cc: <gregkh@linuxfoundation.org>, <linux-usb@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] usb: musb: gadget: nuke endpoint before setting its descriptor to NULL
Date: Fri, 15 Apr 2016 08:26:08 -0500	[thread overview]
Message-ID: <20160415132608.GA3876@uda0271908> (raw)
In-Reply-To: <1460651623-7022-2-git-send-email-tal.shorer@gmail.com>

Hi,

On Thu, Apr 14, 2016 at 07:33:43PM +0300, Tal Shorer wrote:
> Some functions, such as f_sourcesink, rely on an endpoint's desc
> field during their requests' complete() callback, so clear it only
> _after_ nuking all requests to avoid NULL pointer dereference.
> 
> Signed-off-by: Tal Shorer <tal.shorer@gmail.com>

Signed-off-by: Bin Liu <b-liu@ti.com>

Regards,
-Bin.

> ---
>  drivers/usb/musb/musb_gadget.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
> index 87bd578..152865b 100644
> --- a/drivers/usb/musb/musb_gadget.c
> +++ b/drivers/usb/musb/musb_gadget.c
> @@ -1164,12 +1164,12 @@ static int musb_gadget_disable(struct usb_ep *ep)
>  		musb_writew(epio, MUSB_RXMAXP, 0);
>  	}
>  
> -	musb_ep->desc = NULL;
> -	musb_ep->end_point.desc = NULL;
> -
>  	/* abort all pending DMA and requests */
>  	nuke(musb_ep, -ESHUTDOWN);
>  
> +	musb_ep->desc = NULL;
> +	musb_ep->end_point.desc = NULL;
> +
>  	schedule_work(&musb->irq_work);
>  
>  	spin_unlock_irqrestore(&(musb->lock), flags);
> -- 
> 2.5.0
> 

      reply	other threads:[~2016-04-15 13:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-14 16:33 [PATCH 0/1] usb: musb: nuke endpoint before setting its descriptor to NULL Tal Shorer
2016-04-14 16:33 ` [PATCH 1/1] usb: musb: gadget: " Tal Shorer
2016-04-15 13:26   ` Bin Liu [this message]

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=20160415132608.GA3876@uda0271908 \
    --to=b-liu@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=tal.shorer@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.