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


Groups > linux.kernel > #1639415

[PATCH 3.18 26/39] USB: serial: mct_u232: fix modem-status error handling

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 3.18 26/39] USB: serial: mct_u232: fix modem-status error handling
Date 2017-05-11 15:10 +0200
Message-ID <tFW0Z-6HP-87@gated-at.bofh.it> (permalink)
References <tFW0W-6HP-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


3.18-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];

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 3.18 00/39] 3.18.53-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 15:10 +0200
  [PATCH 3.18 28/39] USB: serial: sierra: fix bogus alternate-setting assumption Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 15:10 +0200
  [PATCH 3.18 18/39] USB: serial: keyspan_pda: fix receive sanity checks Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 15:10 +0200
  [PATCH 3.18 34/39] ipv4, ipv6: ensure raw socket message is big enough to hold an IP header Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 15:10 +0200
  [PATCH 3.18 10/39] mwifiex: debugfs: Fix (sometimes) off-by-1 SSID print Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 15:10 +0200
  [PATCH 3.18 31/39] brcmfmac: Make skb header writable before use Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 15:10 +0200
  [PATCH 3.18 26/39] USB: serial: mct_u232: fix modem-status error handling Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 15:10 +0200
  [PATCH 3.18 03/39] mtd: cfi: reduce stack size Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 15:10 +0200
  [PATCH 3.18 06/39] powerpc/powernv: Fix opal_exit tracepoint opcode Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 15:20 +0200
  [PATCH 3.18 05/39] cpupower: Fix turbo frequency reporting for pre-Sandy Bridge cores Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 15:20 +0200
  [PATCH 3.18 09/39] ARM: OMAP5 / DRA7: Fix HYP mode boot for thumb2 build Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 15:20 +0200
  [PATCH 3.18 20/39] USB: serial: ssu100: fix control-message error handling Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 15:20 +0200
  [PATCH 3.18 08/39] power: supply: bq24190_charger: Call set_mode_host() on pm_resume() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 15:20 +0200

csiph-web