mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
USB: serial: ti_usb_3410_5052: fix control-message error handling
commit39712e8bfaupstream. Make sure to detect and return an error on zero-length control-message transfers when reading from the device. This addresses a potential failure to detect an empty transmit buffer during close. Also remove a redundant check for short transfer when sending a command. Fixes:1da177e4c3("Linux-2.6.12-rc2") Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
b07e930d1f
commit
94bbbfe21b
@@ -1556,13 +1556,10 @@ static int ti_command_out_sync(struct ti_device *tdev, __u8 command,
|
||||
(USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT),
|
||||
value, moduleid, data, size, 1000);
|
||||
|
||||
if (status == size)
|
||||
status = 0;
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
if (status > 0)
|
||||
status = -ECOMM;
|
||||
|
||||
return status;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1578,8 +1575,7 @@ static int ti_command_in_sync(struct ti_device *tdev, __u8 command,
|
||||
|
||||
if (status == size)
|
||||
status = 0;
|
||||
|
||||
if (status > 0)
|
||||
else if (status >= 0)
|
||||
status = -ECOMM;
|
||||
|
||||
return status;
|
||||
|
||||
Reference in New Issue
Block a user