lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.11.1409222012230.1839@localhost.localdomain>
Date:	Mon, 22 Sep 2014 20:20:17 +0000 (UTC)
From:	Scot Doyle <lkml14@...tdoyle.com>
To:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Alan Stern <stern@...land.harvard.edu>,
	Sarah Sharp <sarah.a.sharp@...ux.intel.com>,
	Dan Williams <dan.j.williams@...el.com>
cc:	Daniel Mack <daniel@...aq.de>, linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH] usb: core: downgrade log severity to info when descriptor
 missing

According to commit 0cce2eda19923e5e5ccc8b042dec5af87b3ffad0
    USB: fix LANGID=0 regression

usb devices are not required to report string descriptors. Since they are
optional, log an info message instead of an error message. In addition,
use a higher level info message while moving the details to a debug message.

Tested with USB device 0930:021c.

Signed-off-by: Scot Doyle <lkml14@...tdoyle.com>
---
 drivers/usb/core/message.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 0c8a7fc..6b95de7 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -766,7 +766,7 @@ static int usb_get_langid(struct usb_device *dev, unsigned char *tbuf)

 	/* If the string was reported but is malformed, default to english
 	 * (0x0409) */
-	if (err == -ENODATA || (err > 0 && err < 4)) {
+	if (err > 0 && err < 4) {
 		dev->string_langid = 0x0409;
 		dev->have_langid = 1;
 		dev_err(&dev->dev,
@@ -776,6 +776,18 @@ static int usb_get_langid(struct usb_device *dev, unsigned char *tbuf)
 		return 0;
 	}

+	/* If the string was unavailable, default to english (0x0409) */
+	if (err == -ENODATA) {
+		dev->string_langid = 0x0409;
+		dev->have_langid = 1;
+		dev_info(&dev->dev,
+			"no string descriptor language, defaulting to English");
+		dev_dbg(&dev->dev,
+			"string descriptor 0 unavailable (err = -ENODATA), "
+			"defaulting to 0x%04x\n", dev->string_langid);
+		return 0;
+	}
+
 	/* In case of all other errors, we assume the device is not able to
 	 * deal with strings at all. Set string_langid to -1 in order to
 	 * prevent any string to be retrieved from the device */
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ