Re: [PATCH 1/5] USB: ftdi_sio: fix null deref at port probe
On Thu, Jun 05, 2014 at 05:13:49PM +0100, Ben Hutchings wrote: > On Thu, 2014-06-05 at 16:05 +0200, Johan Hovold wrote: > > Fix NULL-pointer dereference when probing an interface with no > > endpoints. > > > > These devices have two bulk endpoints per interface, but this avoids > > crashing the kernel if a user forces a non-FTDI device to be probed. > > > > Note that the iterator variable was made unsigned in order to avoid > > a maybe-uninitialized compiler warning for ep_desc after the loop. > > > > Fixes: 895f28badce9 ("USB: ftdi_sio: fix hi-speed device packet size > > calculation") > > > > Reported-by: Mike Remski > > Tested-by: Mike Remski > > Cc: # 2.3.61 > [...] > > Or maybe 2.6.31? Thanks, I'll fix that up before applying. :) Johan -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/5] USB: ftdi_sio: fix null deref at port probe
On Thu, 2014-06-05 at 16:05 +0200, Johan Hovold wrote: > Fix NULL-pointer dereference when probing an interface with no > endpoints. > > These devices have two bulk endpoints per interface, but this avoids > crashing the kernel if a user forces a non-FTDI device to be probed. > > Note that the iterator variable was made unsigned in order to avoid > a maybe-uninitialized compiler warning for ep_desc after the loop. > > Fixes: 895f28badce9 ("USB: ftdi_sio: fix hi-speed device packet size > calculation") > > Reported-by: Mike Remski > Tested-by: Mike Remski > Cc: # 2.3.61 [...] Or maybe 2.6.31? Ben. -- Ben Hutchings I say we take off; nuke the site from orbit. It's the only way to be sure. signature.asc Description: This is a digitally signed message part
[PATCH 1/5] USB: ftdi_sio: fix null deref at port probe
Fix NULL-pointer dereference when probing an interface with no endpoints. These devices have two bulk endpoints per interface, but this avoids crashing the kernel if a user forces a non-FTDI device to be probed. Note that the iterator variable was made unsigned in order to avoid a maybe-uninitialized compiler warning for ep_desc after the loop. Fixes: 895f28badce9 ("USB: ftdi_sio: fix hi-speed device packet size calculation") Reported-by: Mike Remski Tested-by: Mike Remski Cc: # 2.3.61 Signed-off-by: Johan Hovold --- drivers/usb/serial/ftdi_sio.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 7c6e1dedeb06..3019141397eb 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -1564,14 +1564,17 @@ static void ftdi_set_max_packet_size(struct usb_serial_port *port) struct usb_device *udev = serial->dev; struct usb_interface *interface = serial->interface; - struct usb_endpoint_descriptor *ep_desc = &interface->cur_altsetting->endpoint[1].desc; + struct usb_endpoint_descriptor *ep_desc; unsigned num_endpoints; - int i; + unsigned i; num_endpoints = interface->cur_altsetting->desc.bNumEndpoints; dev_info(&udev->dev, "Number of endpoints %d\n", num_endpoints); + if (!num_endpoints) + return; + /* NOTE: some customers have programmed FT232R/FT245R devices * with an endpoint size of 0 - not good. In this case, we * want to override the endpoint descriptor setting and use a -- 1.8.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html