mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-26 04:20:23 +09:00
FROMGIT: xhci: check port array allocation was successful before dereferencing it
return if rhub->ports is null after rhub->ports = kcalloc_node()
Klockwork reported issue
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20210406070208.3406266-2-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 8a157d2ff1
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I4c2e0452d214a3c4331b6e4ab25b7afb5b99a318
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
412bd71850
commit
a201b4369c
@@ -2343,6 +2343,9 @@ static void xhci_create_rhub_port_array(struct xhci_hcd *xhci,
|
||||
return;
|
||||
rhub->ports = kcalloc_node(rhub->num_ports, sizeof(*rhub->ports),
|
||||
flags, dev_to_node(dev));
|
||||
if (!rhub->ports)
|
||||
return;
|
||||
|
||||
for (i = 0; i < HCS_MAX_PORTS(xhci->hcs_params1); i++) {
|
||||
if (xhci->hw_ports[i].rhub != rhub ||
|
||||
xhci->hw_ports[i].hcd_portnum == DUPLICATE_ENTRY)
|
||||
|
||||
Reference in New Issue
Block a user