Commit 4372f2e6 authored by Johan Hovold's avatar Johan Hovold Committed by Ben Hutchings

USB: serial: keyspan_pda: verify endpoints at probe

commit 5d9b0f85 upstream.

Check for the expected endpoints in attach() and fail loudly if not
present.

Note that failing to do this appears to be benign since da280e34
("USB: keyspan_pda: clean up write-urb busy handling") which prevents a
NULL-pointer dereference in write() by never marking a non-existent
write-urb as free.

Fixes: 1da177e4 ("Linux-2.6.12-rc2")
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
[bwh: Backported to 3.2: add this check to the existing
 usb_serial_driver::attach implementation]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent a318411d
......@@ -806,9 +806,15 @@ MODULE_FIRMWARE("keyspan_pda/xircom_pgs.fw");
static int keyspan_pda_startup(struct usb_serial *serial)
{
unsigned char num_ports = serial->num_ports;
struct keyspan_pda_private *priv;
if (serial->num_bulk_out < num_ports ||
serial->num_interrupt_in < num_ports) {
dev_err(&serial->interface->dev, "missing endpoints\n");
return -ENODEV;
}
/* allocate the private data structures for all ports. Well, for all
one ports. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment