OSDN Git Service

USB: gadget: storage gadgets send wrong error code for unknown commands
authorAlan Stern <stern@rowland.harvard.edu>
Wed, 11 Apr 2012 20:09:10 +0000 (16:09 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 7 May 2012 15:56:36 +0000 (08:56 -0700)
commit06200304e7eb237015f433bd8884975e93aba1f5
tree959318315374c7637e9e72788e5d5cc699198a6b
parenta8eaeff79eb97662e2d06cc1919d902fc251e9da
USB: gadget: storage gadgets send wrong error code for unknown commands

commit c85dcdac5852295cf6822f5c4331a6ddab72581f upstream.

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>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/f_mass_storage.c
drivers/usb/gadget/file_storage.c