Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1639551 > unrolled thread

[PATCH 4.4 36/60] USB: serial: mct_u232: fix modem-status error handling

Started byGreg Kroah-Hartman <gregkh@linuxfoundation.org>
First post2017-05-11 16:30 +0200
Last post2017-05-11 16:30 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 4.4 36/60] USB: serial: mct_u232: fix modem-status error handling Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 16:30 +0200

#1639551 — [PATCH 4.4 36/60] USB: serial: mct_u232: fix modem-status error handling

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-05-11 16:30 +0200
Subject[PATCH 4.4 36/60] USB: serial: mct_u232: fix modem-status error handling
Message-ID<tFXgn-7ta-59@gated-at.bofh.it>
4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Johan Hovold <johan@kernel.org>

commit 36356a669eddb32917fc4b5c2b9b8bf80ede69de upstream.

Make sure to detect short control-message transfers so that errors are
logged when reading the modem status at open.

Note that while this also avoids initialising the modem status using
uninitialised heap data, these bits could not leak to user space as they
are currently not used.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/serial/mct_u232.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/drivers/usb/serial/mct_u232.c
+++ b/drivers/usb/serial/mct_u232.c
@@ -322,8 +322,12 @@ static int mct_u232_get_modem_stat(struc
 			MCT_U232_GET_REQUEST_TYPE,
 			0, 0, buf, MCT_U232_GET_MODEM_STAT_SIZE,
 			WDR_TIMEOUT);
-	if (rc < 0) {
+	if (rc < MCT_U232_GET_MODEM_STAT_SIZE) {
 		dev_err(&port->dev, "Get MODEM STATus failed (error = %d)\n", rc);
+
+		if (rc >= 0)
+			rc = -EIO;
+
 		*msr = 0;
 	} else {
 		*msr = buf[0];

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web