Skip to content

Commit 49cd2f4

Browse files
oneukumgregkh
authored andcommitted
USB: misc: cypress_cy7c63: check for short transfer
As we process the second byte of a control transfer, transfers of less than 2 bytes must be discarded. This bug is as old as the driver. SIgned-off-by: Oliver Neukum <[email protected]> CC: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 8265d06 commit 49cd2f4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/usb/misc/cypress_cy7c63.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ static int vendor_command(struct cypress *dev, unsigned char request,
8888
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_OTHER,
8989
address, data, iobuf, CYPRESS_MAX_REQSIZE,
9090
USB_CTRL_GET_TIMEOUT);
91+
/* we must not process garbage */
92+
if (retval < 2)
93+
goto err_buf;
9194

9295
/* store returned data (more READs to be added) */
9396
switch (request) {
@@ -107,6 +110,7 @@ static int vendor_command(struct cypress *dev, unsigned char request,
107110
break;
108111
}
109112

113+
err_buf:
110114
kfree(iobuf);
111115
error:
112116
return retval;

0 commit comments

Comments
 (0)