[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190125163706.GI18982@uda0271908>
Date: Fri, 25 Jan 2019 10:37:06 -0600
From: Bin Liu <b-liu@...com>
To: "Matwey V. Kornilov" <matwey@....msu.ru>
CC: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
<matwey.kornilov@...il.com>,
"open list:MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER"
<linux-usb@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] usb: musb: Fix potential NULL dereference
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@....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.
Powered by blists - more mailing lists