Commit 12943f097e5a4a0550f52f98ab8f476435e2ce15

Authored by Alan Stern
Committed by Greg Kroah-Hartman
1 parent 94d0f7eac7

USB: less-restrictive command checking in g-file-storage

This patch (as983) makes a test for minimum-length command sizes in
g_file_storage less restrictive.  It doesn't matter because commands
with bad lengths will be detected later on anyway, and doing it like
this makes the driver interoperable with certain buggy hosts such as
the JVC HiFi (reported by Samuel Hangouet).

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

drivers/usb/gadget/file_storage.c
... ... @@ -2964,7 +2964,7 @@
2964 2964  
2965 2965 /* Is the CBW meaningful? */
2966 2966 if (cbw->Lun >= MAX_LUNS || cbw->Flags & ~USB_BULK_IN_FLAG ||
2967   - cbw->Length < 6 || cbw->Length > MAX_COMMAND_SIZE) {
  2967 + cbw->Length <= 0 || cbw->Length > MAX_COMMAND_SIZE) {
2968 2968 DBG(fsg, "non-meaningful CBW: lun = %u, flags = 0x%x, "
2969 2969 "cmdlen %u\n",
2970 2970 cbw->Lun, cbw->Flags, cbw->Length);