diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2012-04-12 00:09:10 +0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2012-04-12 17:20:10 +0400 |
commit | c85dcdac5852295cf6822f5c4331a6ddab72581f (patch) | |
tree | 4ff3f3addfbed73df3e0ff92f9c39cec8e831566 /drivers/usb/gadget/f_mass_storage.c | |
parent | 662c738d9946de521dcece2b146dced335242389 (diff) | |
download | linux-c85dcdac5852295cf6822f5c4331a6ddab72581f.tar.xz |
USB: gadget: storage gadgets send wrong error code for unknown commands
This patch (as1539) fixes a minor bug in the mass-storage gadget
drivers. When an unknown command is received, the error code sent
back is "Invalid Field in CDB" rather than "Invalid Command". This is
because the bitmask of CDB bytes allowed to be nonzero is incorrect.
When handling an unknown command, we don't care which command bytes
are nonzero. All the bits in the mask should be set, not just eight
of them.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: <Michal Nazarewicz <mina86@mina86.com>
CC: <stable@vger.kernel.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/f_mass_storage.c')
-rw-r--r-- | drivers/usb/gadget/f_mass_storage.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index a371e966425f..cb8c162cae5a 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c @@ -2189,7 +2189,7 @@ unknown_cmnd: common->data_size_from_cmnd = 0; sprintf(unknown, "Unknown x%02x", common->cmnd[0]); reply = check_command(common, common->cmnd_size, - DATA_DIR_UNKNOWN, 0xff, 0, unknown); + DATA_DIR_UNKNOWN, ~0, 0, unknown); if (reply == 0) { common->curlun->sense_data = SS_INVALID_COMMAND; reply = -EINVAL; |