Skip to content

Commit 2ad294d

Browse files
gclementgregkh
authored andcommitted
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: 4efb2f6 ("usb: host: xhci-plat: add struct xhci_plat_priv") Cc: [email protected] Signed-off-by: Gregory CLEMENT <[email protected]> Signed-off-by: Mathias Nyman <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 882fa27 commit 2ad294d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/usb/host/xhci-plat.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ static int xhci_plat_probe(struct platform_device *pdev)
184184
struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
185185

186186
/* Just copy data for now */
187-
*priv = *priv_match;
187+
if (priv_match)
188+
*priv = *priv_match;
188189
}
189190

190191
if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_MARVELL_ARMADA)) {

0 commit comments

Comments
 (0)