From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Zixuan Fu <r33s3n6@gmail.com>,
mathias.nyman@intel.com, gregkh@linuxfoundation.org
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
baijiaju1990@gmail.com, TOTE Robot <oslab@tsinghua.edu.cn>
Subject: Re: [PATCH v2 resend] drivers: usb: host: fix NULL pointer dereferences triggered by unhandled errors in xhci_create_rhub_port_array()
Date: Thu, 28 Apr 2022 15:44:29 +0300 [thread overview]
Message-ID: <eb417aeb-92f2-8910-378f-00031fbbcae5@linux.intel.com> (raw)
In-Reply-To: <20220428092321.3011983-1-r33s3n6@gmail.com>
On 28.4.2022 12.23, Zixuan Fu wrote:
> In xhci_create_rhub_port_array(), when rhub->num_ports is zero,
> rhub->ports would not be set; when kcalloc_node() fails, rhub->ports
> would be set to NULL. In these two cases, xhci_create_rhub_port_array()
> just returns void, and thus its callers are unaware of the error.
>
> Then rhub->ports is dereferenced in xhci_usb3_hub_descriptor() or
> xhci_usb2_hub_descriptor().
As it turned out this dereference is only an issue if kcalloc_node() failed,
not if rhub->num_ports is zero.
So this is more of a theoretical issue. Not urgent, not for stable.
So as Greg suggested its probably better to add this fix on top of
the one roothub support series it conflicts with.
Thanks
Mathias
prev parent reply other threads:[~2022-04-28 12:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-28 9:23 [PATCH v2 resend] drivers: usb: host: fix NULL pointer dereferences triggered by unhandled errors in xhci_create_rhub_port_array() Zixuan Fu
2022-04-28 12:44 ` 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=eb417aeb-92f2-8910-378f-00031fbbcae5@linux.intel.com \
--to=mathias.nyman@linux.intel.com \
--cc=baijiaju1990@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=oslab@tsinghua.edu.cn \
--cc=r33s3n6@gmail.com \
/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