]> git.baikalelectronics.ru Git - kernel.git/commit
USB: serial: use port endpoint size to determine if ep is available
authorJohan Hovold <jhovold@gmail.com>
Sat, 27 Feb 2010 15:24:49 +0000 (16:24 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 19 Mar 2010 14:24:03 +0000 (07:24 -0700)
commitbed1ca4c6a394fb08004712523690fcedda49538
treea6dee42012439d65e48bb89e274d44c95246f5e1
parentf1c05db5cecfab5786987ede7ccea1dd111b8dda
USB: serial: use port endpoint size to determine if ep is available

It is possible to have a multi-port device with a port lacking an in or
out bulk endpoint. Only checking for num_bulk_in or num_bulk_out is thus not
sufficient to determine whether a specific port has an in or out bulk
endpoint.

This fixes potential null pointer dereferences in the generic open and
write routines, as well as access to uninitialised fifo in write_room
and chars_in_buffer.

Also let write fail with ENODEV (instead of 0) on missing out endpoint
(also on zero-length writes).

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/serial/generic.c