usb: host: xhci: Fix Null pointer dereferencing with 71c731a for non-x86 systems
authorVivek Gautam <gautam.vivek@samsung.com>
Sat, 22 Sep 2012 12:41:19 +0000 (18:11 +0530)
committerSarah Sharp <sarah.a.sharp@linux.intel.com>
Mon, 24 Sep 2012 19:11:10 +0000 (12:11 -0700)
In 71c731a: usb: host: xhci: Fix Compliance Mode on SN65LVPE502CP Hardware
when extracting DMI strings (vendor or product_name) to mark them as quirk
we may get NULL pointer in case of non-x86 systems which won't define
CONFIG_DMI. Hence susbsequent strstr() calls crash while driver probing.

So, returning 'false' here in case we get a NULL vendor or product_name.

This is tested with ARM (exynos) system.

This patch should be backported to stable kernels as old as 3.6, that
contain the commit 71c731a296f1b08a3724bd1b514b64f1bda87a23 "usb: host:
xhci: Fix Compliance Mode on SN65LVPE502CP Hardware"

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Reported-by: Sebastian Gottschall (DD-WRT) <s.gottschall@dd-wrt.com>
Cc: stable@vger.kernel.org
drivers/usb/host/xhci.c

index 52b04b0880c341ad058372f9319620aff0a15757..8d7fcbbe6ade92df9dab163402be686544ae7f84 100644 (file)
@@ -471,6 +471,8 @@ static bool compliance_mode_recovery_timer_quirk_check(void)
 
        dmi_product_name = dmi_get_system_info(DMI_PRODUCT_NAME);
        dmi_sys_vendor = dmi_get_system_info(DMI_SYS_VENDOR);
+       if (!dmi_product_name || !dmi_sys_vendor)
+               return false;
 
        if (!(strstr(dmi_sys_vendor, "Hewlett-Packard")))
                return false;