[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <80f92044-6f3d-cdd8-a7d4-8793927a648b@linux.intel.com>
Date: Thu, 23 Mar 2023 14:51:38 +0200
From: Mathias Nyman <mathias.nyman@...ux.intel.com>
To: Jia-Ju Bai <baijiaju@...a.edu.cn>, mathias.nyman@...el.com,
gregkh@...uxfoundation.org, p.zabel@...gutronix.de
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] usb: host: xhci: Add a NULL check of hcd in
xhci_plat_remove()
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
Powered by blists - more mailing lists