Skip to content

Commit 7150406

Browse files
LuBaolugregkh
authored andcommitted
usb: xhci: fix wild pointers in xhci_mem_cleanup
This patch fixes some wild pointers produced by xhci_mem_cleanup. These wild pointers will cause system crash if xhci_mem_cleanup() is called twice. Reported-and-tested-by: Pengcheng Li <lpc.li@hisilicon.com> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Cc: stable@vger.kernel.org Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 5ad3b03 commit 7150406

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/usb/host/xhci-mem.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1861,6 +1861,12 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
18611861
kfree(xhci->rh_bw);
18621862
kfree(xhci->ext_caps);
18631863

1864+
xhci->usb2_ports = NULL;
1865+
xhci->usb3_ports = NULL;
1866+
xhci->port_array = NULL;
1867+
xhci->rh_bw = NULL;
1868+
xhci->ext_caps = NULL;
1869+
18641870
xhci->page_size = 0;
18651871
xhci->page_shift = 0;
18661872
xhci->bus_state[0].bus_suspended = 0;

0 commit comments

Comments
 (0)