Re: [PATCH 2/2] usb: musb: Fix a possible null-pointer dereference in musb_handle_intr_connect()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





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@xxxxxxxxx>

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



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux