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

From: Bin Liu
Date: Wed Aug 07 2019 - 16:16:14 EST


On Mon, Jul 29, 2019 at 05:04:28PM +0800, Jia-Ju Bai wrote:
> 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.
>
> To fix this bug, musb->hcd is checked before calling
> musb_host_poke_root_hub().
>
> This bug is found by a static analysis tool STCheck written by us.
>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@xxxxxxxxx>

Applied. Thanks.

-Bin.