public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bin Liu <b-liu@ti.com>
To: "Matwey V. Kornilov" <matwey@sai.msu.ru>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	<matwey.kornilov@gmail.com>,
	"open list:MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER" 
	<linux-usb@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] usb: musb: Fix potential NULL dereference
Date: Fri, 25 Jan 2019 10:37:06 -0600	[thread overview]
Message-ID: <20190125163706.GI18982@uda0271908> (raw)
In-Reply-To: <20190123175142.12604-1-matwey@sai.msu.ru>

On Wed, Jan 23, 2019 at 08:51:42PM +0300, Matwey V. Kornilov wrote:
> We assign "urb->hcpriv = qh;" a few lines down. The valid qh for the urb is
> hep->hcpriv in this code path.
> 
> Fixes: 714bc5ef3eda ("musb: potential use after free")
> Signed-off-by: Matwey V. Kornilov <matwey@sai.msu.ru>
> ---
>  drivers/usb/musb/musb_host.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
> index c6118a962d37..6f267716768e 100644
> --- a/drivers/usb/musb/musb_host.c
> +++ b/drivers/usb/musb/musb_host.c
> @@ -2336,7 +2336,7 @@ static int musb_urb_enqueue(
>  		 * odd, rare, error prone, but legal.
>  		 */
>  		kfree(qh);
> -		qh = NULL;
> +		qh = hep->hcpriv;
>  		ret = 0;
>  	} else
>  		ret = musb_schedule(musb, qh,

Did you run into any issue? The original code seems to be correct to me.

Regards,
-Bin.

      parent reply	other threads:[~2019-01-25 16:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-23 17:51 [PATCH] usb: musb: Fix potential NULL dereference Matwey V. Kornilov
2019-01-24 18:47 ` Matwey V. Kornilov
2019-01-25 16:44   ` Bin Liu
2019-01-25 21:37     ` Alan Stern
2019-01-26  9:45       ` Matwey V. Kornilov
2019-02-18 16:44         ` [PATCH v2] usb: musb: Fix urb->hcpriv value Matwey V. Kornilov
2019-01-25 16:37 ` 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=20190125163706.GI18982@uda0271908 \
    --to=b-liu@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=matwey.kornilov@gmail.com \
    --cc=matwey@sai.msu.ru \
    /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