Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit 7bcd961

Browse files
oneukumgregkh
authored andcommittedOct 4, 2024
USB: misc: cypress_cy7c63: check for short transfer
commit 49cd2f4 upstream. 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 <oneukum@suse.com> CC: stable@vger.kernel.org Link: https://lore.kernel.org/r/20240912125449.1030536-1-oneukum@suse.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ef08eb1 commit 7bcd961

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed
 

‎drivers/usb/misc/cypress_cy7c63.c

+4
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)
This repository has been archived.