All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] USB: mct_u232: add sanity checking in probe
       [not found] <1459440266-17193-1-git-send-email-johan@kernel.org>
@ 2016-03-31 16:04 ` Johan Hovold
  2016-03-31 16:04 ` [PATCH 2/3] USB: cypress_m8: add endpoint sanity check Johan Hovold
  2016-03-31 16:04 ` [PATCH 3/3] USB: digi_acceleport: do sanity checking for the number of ports Johan Hovold
  2 siblings, 0 replies; 3+ messages in thread
From: Johan Hovold @ 2016-03-31 16:04 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb, Oliver Neukum, Oliver Neukum, stable, Johan Hovold

From: Oliver Neukum <oneukum@suse.com>

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>
---
 drivers/usb/serial/mct_u232.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
index 4446b8d70ac2..885655315de1 100644
--- a/drivers/usb/serial/mct_u232.c
+++ b/drivers/usb/serial/mct_u232.c
@@ -376,14 +376,21 @@ static void mct_u232_msr_to_state(struct usb_serial_port *port,
 
 static int mct_u232_port_probe(struct usb_serial_port *port)
 {
+	struct usb_serial *serial = port->serial;
 	struct mct_u232_private *priv;
 
+	/* 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(*priv), GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;
 
 	/* Use second interrupt-in endpoint for reading. */
-	priv->read_urb = port->serial->port[1]->interrupt_in_urb;
+	priv->read_urb = serial->port[1]->interrupt_in_urb;
 	priv->read_urb->context = port;
 
 	spin_lock_init(&priv->lock);
-- 
2.7.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/3] USB: cypress_m8: add endpoint sanity check
       [not found] <1459440266-17193-1-git-send-email-johan@kernel.org>
  2016-03-31 16:04 ` [PATCH 1/3] USB: mct_u232: add sanity checking in probe Johan Hovold
@ 2016-03-31 16:04 ` Johan Hovold
  2016-03-31 16:04 ` [PATCH 3/3] USB: digi_acceleport: do sanity checking for the number of ports Johan Hovold
  2 siblings, 0 replies; 3+ messages in thread
From: Johan Hovold @ 2016-03-31 16:04 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb, Oliver Neukum, Oliver Neukum, stable, Johan Hovold

From: Oliver Neukum <oneukum@suse.com>

An attack using missing endpoints exists.

CVE-2016-3137

Signed-off-by: Oliver Neukum <ONeukum@suse.com>
CC: stable@vger.kernel.org
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/usb/serial/cypress_m8.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
index b283eb8b86d6..bbeeb2bd55a8 100644
--- a/drivers/usb/serial/cypress_m8.c
+++ b/drivers/usb/serial/cypress_m8.c
@@ -447,6 +447,11 @@ static int cypress_generic_port_probe(struct usb_serial_port *port)
 	struct usb_serial *serial = port->serial;
 	struct cypress_private *priv;
 
+	if (!port->interrupt_out_urb || !port->interrupt_in_urb) {
+		dev_err(&port->dev, "required endpoint is missing\n");
+		return -ENODEV;
+	}
+
 	priv = kzalloc(sizeof(struct cypress_private), GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;
@@ -606,12 +611,6 @@ static int cypress_open(struct tty_struct *tty, struct usb_serial_port *port)
 		cypress_set_termios(tty, port, &priv->tmp_termios);
 
 	/* setup the port and start reading from the device */
-	if (!port->interrupt_in_urb) {
-		dev_err(&port->dev, "%s - interrupt_in_urb is empty!\n",
-			__func__);
-		return -1;
-	}
-
 	usb_fill_int_urb(port->interrupt_in_urb, serial->dev,
 		usb_rcvintpipe(serial->dev, port->interrupt_in_endpointAddress),
 		port->interrupt_in_urb->transfer_buffer,
-- 
2.7.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 3/3] USB: digi_acceleport: do sanity checking for the number of ports
       [not found] <1459440266-17193-1-git-send-email-johan@kernel.org>
  2016-03-31 16:04 ` [PATCH 1/3] USB: mct_u232: add sanity checking in probe Johan Hovold
  2016-03-31 16:04 ` [PATCH 2/3] USB: cypress_m8: add endpoint sanity check Johan Hovold
@ 2016-03-31 16:04 ` Johan Hovold
  2 siblings, 0 replies; 3+ messages in thread
From: Johan Hovold @ 2016-03-31 16:04 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb, Oliver Neukum, Oliver Neukum, stable, Johan Hovold

From: Oliver Neukum <oneukum@suse.com>

The driver can be crashed with devices that expose crafted descriptors
with too few endpoints.

See: http://seclists.org/bugtraq/2016/Mar/61

Signed-off-by: Oliver Neukum <ONeukum@suse.com>
[johan: fix OOB endpoint check and add error messages ]
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/usb/serial/digi_acceleport.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
index 010a42a92688..16e8e37b3b36 100644
--- a/drivers/usb/serial/digi_acceleport.c
+++ b/drivers/usb/serial/digi_acceleport.c
@@ -1251,8 +1251,27 @@ static int digi_port_init(struct usb_serial_port *port, unsigned port_num)
 
 static int digi_startup(struct usb_serial *serial)
 {
+	struct device *dev = &serial->interface->dev;
 	struct digi_serial *serial_priv;
 	int ret;
+	int i;
+
+	/* check whether the device has the expected number of endpoints */
+	if (serial->num_port_pointers < serial->type->num_ports + 1) {
+		dev_err(dev, "OOB endpoints missing\n");
+		return -ENODEV;
+	}
+
+	for (i = 0; i < serial->type->num_ports + 1 ; i++) {
+		if (!serial->port[i]->read_urb) {
+			dev_err(dev, "bulk-in endpoint missing\n");
+			return -ENODEV;
+		}
+		if (!serial->port[i]->write_urb) {
+			dev_err(dev, "bulk-out endpoint missing\n");
+			return -ENODEV;
+		}
+	}
 
 	serial_priv = kzalloc(sizeof(*serial_priv), GFP_KERNEL);
 	if (!serial_priv)
-- 
2.7.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-31 16:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1459440266-17193-1-git-send-email-johan@kernel.org>
2016-03-31 16:04 ` [PATCH 1/3] USB: mct_u232: add sanity checking in probe Johan Hovold
2016-03-31 16:04 ` [PATCH 2/3] USB: cypress_m8: add endpoint sanity check Johan Hovold
2016-03-31 16:04 ` [PATCH 3/3] USB: digi_acceleport: do sanity checking for the number of ports Johan Hovold

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.