Re: [PATCH] usb: host: xhci: Add a NULL check of hcd in xhci_plat_remove()

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

 



On 23.3.2023 10.13, Jia-Ju Bai wrote:
In a previous commit d7de14d74d65 ("usb: xhci_plat_remove: avoid NULL
dereference"), hcd can be NULL in usb_remove_hcd(), and thus it should
be checked before being used.

hcd shouldn't be null in usb_remove_hcd()
That was a bug which was properly fixed shortly after in:

4a593a62a9e3 xhci: Fix null pointer dereference in remove if xHC has only one roothub

I guess commit d7de14d74d65 ("usb: xhci_plat_remove: avoid NULL dereference") Isn't really
needed either anymore, but no harm in keeping it.


However, in the call stack of this commit, hci is also used to get xhci:
> xhci_plat_remove()
   xhci = hcd_to_xhci(hcd)
     usb_hcd_is_primary_hcd(hcd)
       if (!hcd->primary_hcd) -> No check for hcd
     primary_hcd = hcd->primary_hcd; -> No check for hcd
   usb_remove_hcd(hcd)
     if (!hcd) -> Add a check by the previous commit

These hcd checks shouldn't be needed.

Thanks
Mathias



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

  Powered by Linux