From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Jia-Ju Bai <baijiaju1990@gmail.com>
Cc: Bin Liu <b-liu@ti.com>, linux-usb@vger.kernel.org
Subject: Re: [PATCH 2/2] usb: musb: Fix a possible null-pointer dereference in musb_handle_intr_connect()
Date: Wed, 11 Dec 2019 10:20:55 +0100 [thread overview]
Message-ID: <20191211092055.GA505396@kroah.com> (raw)
In-Reply-To: <dc1cbf76-a2c4-a861-0847-d3434b843fee@gmail.com>
On Wed, Dec 11, 2019 at 05:10:17PM +0800, Jia-Ju Bai wrote:
>
>
> On 2019/12/11 16:09, Greg Kroah-Hartman wrote:
> > On Tue, Dec 10, 2019 at 10:54:54AM -0600, Bin Liu wrote:
> > > From: Jia-Ju Bai <baijiaju1990@gmail.com>
> > >
> > > In musb_handle_intr_connect(), there is an if statement on line 783 to
> > > check whether musb->hcd is NULL:
> > > if (musb->hcd)
> > >
> > > When musb->hcd is NULL, it is used on line 797:
> > > musb_host_poke_root_hub(musb);
> > > if (musb->hcd->status_urb)
> > >
> > > Thus, a possible null-pointer dereference may occur.
> > Maybe, if musb->hcd really ever could be NULL.
> >
> > In looking at the code, I don't see where that could happen, do you?
> > Why is that check there in the first place?
> >
> > What sets musb->hcd to NULL in the first place?
>
> In fact, my static analysis tool identifies an if check about musb->hcd, so
> it infers that musb->hcd could be NULL here.
> But it does not try to find any explicit place that set musb->hcd to NULL.
Can it do that?
> If musb->hcd is never NULL here, we can just delete the related if check.
I agree :)
thanks,
greg k-h
next prev parent reply other threads:[~2019-12-11 9:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-10 16:54 [PATCH 0/2] musb fixes for v5.5-rc2 Bin Liu
2019-12-10 16:54 ` [PATCH 1/2] usb: musb: sunxi: propagate devicetree node to glue pdev Bin Liu
2019-12-11 8:05 ` Greg Kroah-Hartman
2019-12-11 8:49 ` Johan Hovold
2019-12-11 8:51 ` Greg Kroah-Hartman
2019-12-11 8:53 ` Johan Hovold
2019-12-10 16:54 ` [PATCH 2/2] usb: musb: Fix a possible null-pointer dereference in musb_handle_intr_connect() Bin Liu
2019-12-11 8:09 ` Greg Kroah-Hartman
2019-12-11 9:10 ` Jia-Ju Bai
2019-12-11 9:20 ` Greg Kroah-Hartman [this message]
2019-12-17 8:26 ` Jia-Ju Bai
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=20191211092055.GA505396@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=b-liu@ti.com \
--cc=baijiaju1990@gmail.com \
--cc=linux-usb@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 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.