Skip to contentSkip to conversation

patch "USB: serial: ark3116: fix register-accessor error handling" added to usb-next

PATCH [email protected] 1 participant 1 message Feb 10, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

USB: serial: ark3116: fix register-accessor error handling

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-next branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release during the merge window.

If you have any questions about this process, please let me know.

Quoted 1 line

From 9fef37d7cf170522fb354d6d0ea6de09b9b16678 Mon Sep 17 00:00:00 2001

From: Johan Hovold <[email protected]>
Date: Thu, 12 Jan 2017 14:56:09 +0100
Subject: USB: serial: ark3116: fix register-accessor error handling

The current implementation failed to detect short transfers, something which could lead to bits of the uninitialised heap transfer buffer leaking to user space.

Fixes 149fc791a452 ("USB: ark3116: Setup some basic infrastructure for

new ark3116 driver.")

Fixes f4c1e8d597d1 ("USB: ark3116: Make existing functions 16450-aware

and add close and release functions.")

---
 drivers/usb/serial/ark3116.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/usb/serial/ark3116.c +10 -3
index 1532cde8a437..7812052dc700 100644
@@ -99,10 +99,17 @@ static int ark3116_read_reg(struct usb_serial *serial,
 				 usb_rcvctrlpipe(serial->dev, 0),
 				 0xfe, 0xc0, 0, reg,
 				 buf, 1, ARK_TIMEOUT);
-	if (result < 0)
+	if (result < 1) {
+		dev_err(&serial->interface->dev,
+				"failed to read register %u: %d\n",
+				reg, result);
+		if (result >= 0)
+			result = -EIO;
+
 		return result;
-	else
-		return buf[0];
+	}
+
+	return buf[0];
 }
 
 static inline int calc_divisor(int bps)
Signature · 1 line
2.11.1