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 Tue, Jan 12, 2016 at 11:23:51AM +0100, Johan Hovold wrote:
> On Tue, Jan 12, 2016 at 10:16:35AM +0100, 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.

> >  	/* some sanity check */
> > -	if (serial->num_ports < 2)
> > +	if (serial->num_ports < 2) {
> > +		dev_err(dev, "%s: number of ports %d is less than 2\n",
> > +		    __func__, serial->num_ports);
> 
> Skip __func__, and just use something like "missing endpoints\n".
> 
> >  		return -1;
> > +	}
> 
> Ideally, this should have been done already at probe, but we already
> have some incomplete checks here that we should extend.
> 
> Specifically, you should just verify that both ports have a bulk-out
> endpoint here, e.g.:
> 
> 	if (serial->num_ports < 2 || !serial->port[0].bulk_out_size ||
> 			!serial->port[1].bulk_out_size)
> 		return -ENODEV;

Or even,

	if (serial->num_bulk_in < 2)
		return -ENODEV;

which would cover it all.

Thanks,
Johan
--
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