summaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/xhci-plat.c
diff options
context:
space:
mode:
authorGregory CLEMENT2016-01-26 16:50:11 +0100
committerGreg Kroah-Hartman2016-02-03 23:01:47 +0100
commit2ad294d5f9d13d108c1e2f1a4be8542859ead134 (patch)
treeda813026a36e2dd49343045d470ee1a7b4db48b7 /drivers/usb/host/xhci-plat.c
parentusb: xhci-mtk: fix AHB bus hang up caused by roothubs polling (diff)
downloadkernel-qcow2-linux-2ad294d5f9d13d108c1e2f1a4be8542859ead134.tar.gz
kernel-qcow2-linux-2ad294d5f9d13d108c1e2f1a4be8542859ead134.tar.xz
kernel-qcow2-linux-2ad294d5f9d13d108c1e2f1a4be8542859ead134.zip
usb: host: xhci-plat: fix NULL pointer in probe for device tree case
During probe, in the device tree case, the data pointer associated to a compatible is dereferenced. However, not all the compatibles are associated to a private data pointer. The generic-xhci and the xhci-platform don't need them, this patch adds a test on the data pointer before accessing it, avoiding a kernel crash. Fixes: 4efb2f694114 ("usb: host: xhci-plat: add struct xhci_plat_priv") Cc: stable@vger.kernel.org Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host/xhci-plat.c')
-rw-r--r--drivers/usb/host/xhci-plat.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 770b6b088797..d39d6bf1d090 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -184,7 +184,8 @@ static int xhci_plat_probe(struct platform_device *pdev)
struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
/* Just copy data for now */
- *priv = *priv_match;
+ if (priv_match)
+ *priv = *priv_match;
}
if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_MARVELL_ARMADA)) {