aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorMathias Nyman <mathias.nyman@linux.intel.com>2014-09-11 13:55:48 +0300
committerBen Hutchings <ben@decadent.org.uk>2014-11-05 20:27:42 +0000
commitcd2b663832bf1eeb2f5d15e092546ae0c0d58135 (patch)
tree340e611d1ebd4705a4559c47c359ac9fe4658ce9 /drivers/usb
parent2a163ac939fd6a7c8f96bb577a45e3f5d97a382d (diff)
downloadkernel_samsung_smdk4412-cd2b663832bf1eeb2f5d15e092546ae0c0d58135.zip
kernel_samsung_smdk4412-cd2b663832bf1eeb2f5d15e092546ae0c0d58135.tar.gz
kernel_samsung_smdk4412-cd2b663832bf1eeb2f5d15e092546ae0c0d58135.tar.bz2
xhci: Fix null pointer dereference if xhci initialization fails
commit c207e7c50f31113c24a9f536fcab1e8a256985d7 upstream. If xhci initialization fails before the roothub bandwidth domains (xhci->rh_bw[i]) are allocated it will oops when trying to access rh_bw members in xhci_mem_cleanup(). Reported-by: Manuel Reimer <manuel.reimer@gmx.de> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/xhci-mem.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 74922b9..0f4a41d 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1723,7 +1723,7 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
}
num_ports = HCS_MAX_PORTS(xhci->hcs_params1);
- for (i = 0; i < num_ports; i++) {
+ for (i = 0; i < num_ports && xhci->rh_bw; i++) {
struct xhci_interval_bw_table *bwt = &xhci->rh_bw[i].bw_table;
for (j = 0; j < XHCI_MAX_INTERVAL; j++) {
struct list_head *ep = &bwt->interval_bw[j].endpoints;