]> git.baikalelectronics.ru Git - kernel.git/commit
usb: gadget: f_fs: Only return delayed status when len is 0
authorJerry Zhang <zhangjerry@google.com>
Mon, 2 Jul 2018 19:48:08 +0000 (12:48 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 20 Jul 2018 14:02:49 +0000 (16:02 +0200)
commitc0fec859f77aa22d3efe3280d0a79f63a9d89061
treef87ae3e3ac0ef0251d4ad46a5c35efbb047f47d5
parentcbf20649ac827b96466862224e00d8b5ac30d7d7
usb: gadget: f_fs: Only return delayed status when len is 0

Commit b8ff3740 ("Allow function drivers to pause control
transfers") states that USB_GADGET_DELAYED_STATUS is only
supported if data phase is 0 bytes.

It seems that when the length is not 0 bytes, there is no
need to explicitly delay the data stage since the transfer
is not completed until the user responds. However, when the
length is 0, there is no data stage and the transfer is
finished once setup() returns, hence there is a need to
explicitly delay completion.

This manifests as the following bugs:

Prior to 657fd7e35824 ('Let setup() return
USB_GADGET_DELAYED_STATUS'), when setup is 0 bytes, ffs
would require user to queue a 0 byte request in order to
clear setup state. However, that 0 byte request was actually
not needed and would hang and cause errors in other setup
requests.

After the above commit, 0 byte setups work since the gadget
now accepts empty queues to ep0 to clear the delay, but all
other setups hang.

Fixes: 657fd7e35824 ("Let setup() return USB_GADGET_DELAYED_STATUS")
Signed-off-by: Jerry Zhang <zhangjerry@google.com>
Cc: stable <stable@vger.kernel.org>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/f_fs.c