diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/gadget/file_storage.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index 0c632d22a631..e0f616f39ba0 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c | |||
@@ -2676,11 +2676,24 @@ static int check_command(struct fsg_dev *fsg, int cmnd_size, | |||
2676 | /* Verify the length of the command itself */ | 2676 | /* Verify the length of the command itself */ |
2677 | if (cmnd_size != fsg->cmnd_size) { | 2677 | if (cmnd_size != fsg->cmnd_size) { |
2678 | 2678 | ||
2679 | /* Special case workaround: MS-Windows issues REQUEST SENSE | 2679 | /* Special case workaround: There are plenty of buggy SCSI |
2680 | * with cbw->Length == 12 (it should be 6). */ | 2680 | * implementations. Many have issues with cbw->Length |
2681 | if (fsg->cmnd[0] == SC_REQUEST_SENSE && fsg->cmnd_size == 12) | 2681 | * field passing a wrong command size. For those cases we |
2682 | * always try to work around the problem by using the length | ||
2683 | * sent by the host side provided it is at least as large | ||
2684 | * as the correct command length. | ||
2685 | * Examples of such cases would be MS-Windows, which issues | ||
2686 | * REQUEST SENSE with cbw->Length == 12 where it should | ||
2687 | * be 6, and xbox360 issuing INQUIRY, TEST UNIT READY and | ||
2688 | * REQUEST SENSE with cbw->Length == 10 where it should | ||
2689 | * be 6 as well. | ||
2690 | */ | ||
2691 | if (cmnd_size <= fsg->cmnd_size) { | ||
2692 | DBG(fsg, "%s is buggy! Expected length %d " | ||
2693 | "but we got %d\n", name, | ||
2694 | cmnd_size, fsg->cmnd_size); | ||
2682 | cmnd_size = fsg->cmnd_size; | 2695 | cmnd_size = fsg->cmnd_size; |
2683 | else { | 2696 | } else { |
2684 | fsg->phase_error = 1; | 2697 | fsg->phase_error = 1; |
2685 | return -EINVAL; | 2698 | return -EINVAL; |
2686 | } | 2699 | } |