aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/xhci-mem.c
diff options
context:
space:
mode:
authorVladimir Murzin <murzin.v@gmail.com>2013-04-09 14:33:31 -0400
committerSarah Sharp <sarah.a.sharp@linux.intel.com>2013-05-24 12:14:47 -0400
commit88696ae432ce7321540ac53d9caab3de9118b094 (patch)
tree37c6e9a1055486cf2e413be5402ef6ae30cdcbbb /drivers/usb/host/xhci-mem.c
parent331de00a64e5027365145bdf51da27b9ce15dfd5 (diff)
xhci: fix list access before init
If for whatever reason we fall into fail path in xhci_mem_init() before bw table gets initialized we may access the uninitialized lists in xhci_mem_cleanup(). Check for bw table before traversing lists in cleanup routine. This patch should be backported to kernels as old as 3.2, that contain the commit 839c817ce67178ca3c7c7ad534c571bba1e69ebe "xhci: Store information about roothubs and TTs." Reported-by: Sergey Dyasly <dserrg@gmail.com> Tested-by: Sergey Dyasly <dserrg@gmail.com> Signed-off-by: Vladimir Murzin <murzin.v@gmail.com> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Cc: stable@vger.kernel.org
Diffstat (limited to 'drivers/usb/host/xhci-mem.c')
-rw-r--r--drivers/usb/host/xhci-mem.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index bda2c51a7c74..fbf75e57628b 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1827,6 +1827,9 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
1827 } 1827 }
1828 spin_unlock_irqrestore(&xhci->lock, flags); 1828 spin_unlock_irqrestore(&xhci->lock, flags);
1829 1829
1830 if (!xhci->rh_bw)
1831 goto no_bw;
1832
1830 num_ports = HCS_MAX_PORTS(xhci->hcs_params1); 1833 num_ports = HCS_MAX_PORTS(xhci->hcs_params1);
1831 for (i = 0; i < num_ports; i++) { 1834 for (i = 0; i < num_ports; i++) {
1832 struct xhci_interval_bw_table *bwt = &xhci->rh_bw[i].bw_table; 1835 struct xhci_interval_bw_table *bwt = &xhci->rh_bw[i].bw_table;
@@ -1845,6 +1848,7 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
1845 } 1848 }
1846 } 1849 }
1847 1850
1851no_bw:
1848 xhci->num_usb2_ports = 0; 1852 xhci->num_usb2_ports = 0;
1849 xhci->num_usb3_ports = 0; 1853 xhci->num_usb3_ports = 0;
1850 xhci->num_active_eps = 0; 1854 xhci->num_active_eps = 0;