[PATCH 06/11][CVE-2016-3136] USB: mct_u232: add sanity checking in probe

Luis Henriques luis.henriques at canonical.com
Wed Apr 27 14:15:55 UTC 2016


From: Oliver Neukum <oneukum at suse.com>

commit 4e9a0b05257f29cf4b75f3209243ed71614d062e upstream.

An attack using the lack of sanity checking in probe is known. This
patch checks for the existence of a second port.

CVE-2016-3136

Signed-off-by: Oliver Neukum <ONeukum at suse.com>
[johan: add error message ]
Signed-off-by: Johan Hovold <johan at kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
[bwh: Backported to 3.2: put the check in mct_u232_startup(), which already
 has a 'serial' variable]
Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
BugLink: https://bugs.launchpad.net/bugs/1556877
Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
---
 drivers/usb/serial/mct_u232.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
index 96a62dd5aa3f..a7e7ba65a611 100644
--- a/drivers/usb/serial/mct_u232.c
+++ b/drivers/usb/serial/mct_u232.c
@@ -443,6 +443,12 @@ static int mct_u232_startup(struct usb_serial *serial)
 	struct mct_u232_private *priv;
 	struct usb_serial_port *port, *rport;
 
+	/* check first to simplify error handling */
+	if (!serial->port[1] || !serial->port[1]->interrupt_in_urb) {
+		dev_err(&port->dev, "expected endpoint missing\n");
+		return -ENODEV;
+	}
+
 	priv = kzalloc(sizeof(struct mct_u232_private), GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;




More information about the kernel-team mailing list