Re: [PATCH v2] usb: serial: visor: fix crash on detecting device without write_urbs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/12/2016 12:16 PM, Vladis Dronov wrote:

The visor driver crashes in clie_5_attach() when a specially crafted USB
device without bulk-out endpoint is detected. This fix adds a check that
the device has proper configuration expected by the driver. Also error
message output is added to the one of the error paths.

Reported-by: Ralf Spenneberg <ralf@xxxxxxxxxxxxxx>
Signed-off-by: Vladis Dronov <vdronov@xxxxxxxxxx>
---
Reference: https://bugzilla.redhat.com/show_bug.cgi?id=1296466
patch-v2: codestyle fix

  drivers/usb/serial/visor.c | 15 +++++++++++++--
  1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index 60afb39..6cb0e03 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
[...]
@@ -607,7 +611,14 @@ static int clie_5_attach(struct usb_serial *serial)

  	pipe = usb_sndbulkpipe(serial->dev, port->bulk_out_endpointAddress);
  	for (j = 0; j < ARRAY_SIZE(port->write_urbs); ++j)
-		port->write_urbs[j]->pipe = pipe;
+		if (port->write_urbs[j]) {
+			port->write_urbs[j]->pipe = pipe;
+		}
+		else {

		} else {

+			dev_err(dev, "%s: write_urbs %d for port 0 was not allocated\n",
+			    __func__, j);
+			return -1;
+		}

  	return 0;
  }

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux