From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Jia-Ju Bai <baijiaju@buaa.edu.cn>,
mathias.nyman@intel.com, gregkh@linuxfoundation.org,
p.zabel@pengutronix.de
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: host: xhci: Add a NULL check of hcd in xhci_plat_remove()
Date: Thu, 23 Mar 2023 14:51:38 +0200 [thread overview]
Message-ID: <80f92044-6f3d-cdd8-a7d4-8793927a648b@linux.intel.com> (raw)
In-Reply-To: <20230323081329.366459-1-baijiaju@buaa.edu.cn>
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
prev parent reply other threads:[~2023-03-23 12:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-23 8:13 Jia-Ju Bai
2023-03-23 12:51 ` Mathias Nyman [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=80f92044-6f3d-cdd8-a7d4-8793927a648b@linux.intel.com \
--to=mathias.nyman@linux.intel.com \
--cc=baijiaju@buaa.edu.cn \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=p.zabel@pengutronix.de \
/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
all inboxes | Powered by JetHome®