Return-Path: Received: from mga03.intel.com ([134.134.136.65]:58122 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966579AbcAZPpW (ORCPT ); Tue, 26 Jan 2016 10:45:22 -0500 From: Mathias Nyman To: Cc: , Gregory CLEMENT , stable@vger.kernel.org, Mathias Nyman Subject: [PATCH 8/9] usb: host: xhci-plat: fix NULL pointer in probe for device tree case Date: Tue, 26 Jan 2016 17:50:11 +0200 Message-Id: <1453823412-11161-9-git-send-email-mathias.nyman@linux.intel.com> In-Reply-To: <1453823412-11161-1-git-send-email-mathias.nyman@linux.intel.com> References: <1453823412-11161-1-git-send-email-mathias.nyman@linux.intel.com> Sender: stable-owner@vger.kernel.org List-ID: From: Gregory CLEMENT 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 Signed-off-by: Mathias Nyman --- drivers/usb/host/xhci-plat.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 770b6b0..d39d6bf 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)) { -- 1.9.1