Skip to content

Commit 4e9a0b0

Browse files
oneukumgregkh
authored andcommitted
USB: mct_u232: add sanity checking in probe
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@suse.com> CC: stable@vger.kernel.org [johan: add error message ] Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 59b9023 commit 4e9a0b0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Diff for: drivers/usb/serial/mct_u232.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -376,14 +376,21 @@ static void mct_u232_msr_to_state(struct usb_serial_port *port,
376376

377377
static int mct_u232_port_probe(struct usb_serial_port *port)
378378
{
379+
struct usb_serial *serial = port->serial;
379380
struct mct_u232_private *priv;
380381

382+
/* check first to simplify error handling */
383+
if (!serial->port[1] || !serial->port[1]->interrupt_in_urb) {
384+
dev_err(&port->dev, "expected endpoint missing\n");
385+
return -ENODEV;
386+
}
387+
381388
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
382389
if (!priv)
383390
return -ENOMEM;
384391

385392
/* Use second interrupt-in endpoint for reading. */
386-
priv->read_urb = port->serial->port[1]->interrupt_in_urb;
393+
priv->read_urb = serial->port[1]->interrupt_in_urb;
387394
priv->read_urb->context = port;
388395

389396
spin_lock_init(&priv->lock);

0 commit comments

Comments
 (0)