[PATCH] usb: host: xhci: Fix initialization on systems without DMI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From 7218d6610af3b85cefed821420eab768fdf1e2d3 Mon Sep 17 00:00:00 2001
From: Paul Mackerras <paulus@xxxxxxxxx>
Date: Mon, 22 Oct 2012 12:12:19 +1100
Subject: [PATCH] usb: host: xhci: Fix initialization on systems without DMI

Commit 71c731a296 ("usb: host: xhci: Fix Compliance Mode on
SN65LVPE502CP Hardware") added a DMI-based check for certain systems
which need a workaround.  However, the added code blindly assumed
that the DMI values it was checking would be present on the system.
On systems without DMI -- that is, on any architecture other than
x86 or ia64 -- we end up with dmi_product_name and dmi_sys_vendor
being NULL, resulting in an oops when we try to dereference them
with strstr, as I saw on a 64-bit PowerPC machine.

This fixes it by checking dmi_product_name and dmi_sys_vendor to see
whether they are NULL before passing them to strstr().

Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Paul Mackerras <paulus@xxxxxxxxx>
---
 drivers/usb/host/xhci.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 6ece0ed..7a008cb 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -471,6 +471,9 @@ 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;
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux