From: Jia-Ju Bai <baijiaju1990@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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: Tue, 17 Dec 2019 16:26:24 +0800 [thread overview]
Message-ID: <07ac273c-46f1-3f18-9d94-c643ded4fb5f@gmail.com> (raw)
In-Reply-To: <20191211092055.GA505396@kroah.com>
On 2019/12/11 17:20, Greg Kroah-Hartman wrote:
> 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?
Not yet...
>
>> If musb->hcd is never NULL here, we can just delete the related if check.
> I agree :)
Okay, I will send a new patch that delete the if check.
Best wishes,
Jia-Ju Bai
prev parent reply other threads:[~2019-12-17 8:26 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
2019-12-17 8:26 ` Jia-Ju Bai [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=07ac273c-46f1-3f18-9d94-c643ded4fb5f@gmail.com \
--to=baijiaju1990@gmail.com \
--cc=b-liu@ti.com \
--cc=gregkh@linuxfoundation.org \
--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 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).