Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 115763
b: refs/heads/master
c: 549c41e
h: refs/heads/master
i:
  115761: 038f816
  115759: 41fe423
v: v3
  • Loading branch information
Felipe Balbi authored and Greg Kroah-Hartman committed Oct 17, 2008
1 parent 87978ff commit 8d412af
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8296345a35551414b07419f4c9223734c1fc5437
refs/heads/master: 549c41e0ac0a3eb68cfdaeb43c1a314e2a6c289a
21 changes: 17 additions & 4 deletions trunk/drivers/usb/gadget/file_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -2676,11 +2676,24 @@ static int check_command(struct fsg_dev *fsg, int cmnd_size,
/* Verify the length of the command itself */
if (cmnd_size != fsg->cmnd_size) {

/* Special case workaround: MS-Windows issues REQUEST SENSE
* with cbw->Length == 12 (it should be 6). */
if (fsg->cmnd[0] == SC_REQUEST_SENSE && fsg->cmnd_size == 12)
/* Special case workaround: There are plenty of buggy SCSI
* implementations. Many have issues with cbw->Length
* field passing a wrong command size. For those cases we
* always try to work around the problem by using the length
* sent by the host side provided it is at least as large
* as the correct command length.
* Examples of such cases would be MS-Windows, which issues
* REQUEST SENSE with cbw->Length == 12 where it should
* be 6, and xbox360 issuing INQUIRY, TEST UNIT READY and
* REQUEST SENSE with cbw->Length == 10 where it should
* be 6 as well.
*/
if (cmnd_size <= fsg->cmnd_size) {
DBG(fsg, "%s is buggy! Expected length %d "
"but we got %d\n", name,
cmnd_size, fsg->cmnd_size);
cmnd_size = fsg->cmnd_size;
else {
} else {
fsg->phase_error = 1;
return -EINVAL;
}
Expand Down

0 comments on commit 8d412af

Please sign in to comment.