[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <eb417aeb-92f2-8910-378f-00031fbbcae5@linux.intel.com>
Date: Thu, 28 Apr 2022 15:44:29 +0300
From: Mathias Nyman <mathias.nyman@...ux.intel.com>
To: Zixuan Fu <r33s3n6@...il.com>, mathias.nyman@...el.com,
gregkh@...uxfoundation.org
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
baijiaju1990@...il.com, TOTE Robot <oslab@...nghua.edu.cn>
Subject: Re: [PATCH v2 resend] drivers: usb: host: fix NULL pointer
dereferences triggered by unhandled errors in xhci_create_rhub_port_array()
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
Powered by blists - more mailing lists