]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.4.68/usb-serial-mct_u232-fix-modem-status-error-handling.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.4.68 / usb-serial-mct_u232-fix-modem-status-error-handling.patch
CommitLineData
857a8367
GKH
1From 36356a669eddb32917fc4b5c2b9b8bf80ede69de Mon Sep 17 00:00:00 2001
2From: Johan Hovold <johan@kernel.org>
3Date: Thu, 12 Jan 2017 14:56:16 +0100
4Subject: USB: serial: mct_u232: fix modem-status error handling
5
6From: Johan Hovold <johan@kernel.org>
7
8commit 36356a669eddb32917fc4b5c2b9b8bf80ede69de upstream.
9
10Make sure to detect short control-message transfers so that errors are
11logged when reading the modem status at open.
12
13Note that while this also avoids initialising the modem status using
14uninitialised heap data, these bits could not leak to user space as they
15are currently not used.
16
17Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
18Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19Signed-off-by: Johan Hovold <johan@kernel.org>
20Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21
22---
23 drivers/usb/serial/mct_u232.c | 6 +++++-
24 1 file changed, 5 insertions(+), 1 deletion(-)
25
26--- a/drivers/usb/serial/mct_u232.c
27+++ b/drivers/usb/serial/mct_u232.c
28@@ -322,8 +322,12 @@ static int mct_u232_get_modem_stat(struc
29 MCT_U232_GET_REQUEST_TYPE,
30 0, 0, buf, MCT_U232_GET_MODEM_STAT_SIZE,
31 WDR_TIMEOUT);
32- if (rc < 0) {
33+ if (rc < MCT_U232_GET_MODEM_STAT_SIZE) {
34 dev_err(&port->dev, "Get MODEM STATus failed (error = %d)\n", rc);
35+
36+ if (rc >= 0)
37+ rc = -EIO;
38+
39 *msr = 0;
40 } else {
41 *msr = buf[0];