OpenCloudOS-Kernel/drivers/usb/gadget/function
Jerry Zhang 4d644abf25 usb: gadget: f_fs: Only return delayed status when len is 0
Commit 1b9ba000 ("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 946ef68ad4 ('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: 946ef68ad4 ("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>
2018-07-20 16:02:49 +02:00
..
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
f_acm.c A couple of configfs cleanups: 2017-11-14 14:44:04 -08:00
f_ecm.c usb: gadget: f_ecm: fix host mac address for multiple instances 2018-05-15 10:17:18 +03:00
f_eem.c net: drivers/net: Remove unnecessary skb_copy_expand OOM messages 2018-03-15 14:28:03 -04:00
f_fs.c usb: gadget: f_fs: Only return delayed status when len is 0 2018-07-20 16:02:49 +02:00
f_hid.c vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
f_loopback.c A couple of configfs cleanups: 2017-11-14 14:44:04 -08:00
f_mass_storage.c A couple of configfs cleanups: 2017-11-14 14:44:04 -08:00
f_mass_storage.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
f_midi.c - Introduce arithmetic overflow test helper functions (Rasmus) 2018-06-06 17:27:14 -07:00
f_ncm.c usb/gadget/NCM: Replace tasklet with softirq hrtimer 2018-01-16 09:51:23 +01:00
f_obex.c A couple of configfs cleanups: 2017-11-14 14:44:04 -08:00
f_phonet.c usb: gadget: f_phonet: fix pn_net_xmit()'s return type 2018-05-21 10:36:14 +03:00
f_printer.c usb: gadget: function: printer: avoid wrong list handling in printer_write() 2018-05-24 18:14:28 +02:00
f_rndis.c A couple of configfs cleanups: 2017-11-14 14:44:04 -08:00
f_serial.c A couple of configfs cleanups: 2017-11-14 14:44:04 -08:00
f_sourcesink.c A couple of configfs cleanups: 2017-11-14 14:44:04 -08:00
f_subset.c A couple of configfs cleanups: 2017-11-14 14:44:04 -08:00
f_tcm.c USB: gadget: function: remove redundant initialization of 'tv_nexus' 2018-03-08 15:12:01 +02:00
f_uac1.c A couple of configfs cleanups: 2017-11-14 14:44:04 -08:00
f_uac1_legacy.c usb: Remove Blackfin references in USB support 2018-03-26 15:57:16 +02:00
f_uac2.c usb: gadget: f_uac2: fix endianness of 'struct cntrl_*_lay3' 2018-07-17 10:12:52 +03:00
f_uvc.c USB: gadget: function: Remove redundant license text 2017-11-07 15:45:02 +01:00
f_uvc.h USB: gadget: function: Remove redundant license text 2017-11-07 15:45:02 +01:00
g_zero.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ndis.h
rndis.c USB: rndis: Fix for handling garbled messages 2018-05-15 10:24:28 +03:00
rndis.h USB: gadget: function: Remove redundant license text 2017-11-07 15:45:02 +01:00
storage_common.c USB: gadget: function: Remove redundant license text 2017-11-07 15:45:02 +01:00
storage_common.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
tcm.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
u_audio.c usb: gadget: u_audio: protect stream runtime fields with stream spinlock 2018-07-17 10:12:51 +03:00
u_audio.h USB: gadget: function: Remove redundant license text 2017-11-07 15:45:02 +01:00
u_ecm.h USB: gadget: function: Remove redundant license text 2017-11-07 15:45:02 +01:00
u_eem.h USB: gadget: function: Remove redundant license text 2017-11-07 15:45:02 +01:00
u_ether.c USB: Gadget Ethernet: Re-enable Jumbo frames. 2018-05-15 10:17:14 +03:00
u_ether.h USB: gadget: function: Remove redundant license text 2017-11-07 15:45:02 +01:00
u_ether_configfs.h USB: gadget: function: Remove redundant license text 2017-11-07 15:45:02 +01:00
u_fs.h USB: gadget: function: Remove redundant license text 2017-11-07 15:45:02 +01:00
u_gether.h USB: gadget: function: Remove redundant license text 2017-11-07 15:45:02 +01:00
u_hid.h USB: gadget: function: Remove redundant license text 2017-11-07 15:45:02 +01:00
u_midi.h USB: gadget: function: Remove redundant license text 2017-11-07 15:45:02 +01:00
u_ncm.h USB: gadget: function: Remove redundant license text 2017-11-07 15:45:02 +01:00
u_phonet.h USB: gadget: function: Remove redundant license text 2017-11-07 15:45:02 +01:00
u_printer.h USB: gadget: function: Remove redundant license text 2017-11-07 15:45:02 +01:00
u_rndis.h USB: gadget: function: Remove redundant license text 2017-11-07 15:45:02 +01:00
u_serial.c usb: gadget: u_serial: Use kfifo instead of homemade circular buffer 2017-12-11 12:36:50 +02:00
u_serial.h USB: gadget: function: Remove redundant license text 2017-11-07 15:45:02 +01:00
u_tcm.h USB: gadget: function: Remove redundant license text 2017-11-07 15:45:02 +01:00
u_uac1.h USB: gadget: function: Remove redundant license text 2017-11-07 15:45:02 +01:00
u_uac1_legacy.c usb: Remove Blackfin references in USB support 2018-03-26 15:57:16 +02:00
u_uac1_legacy.h usb: Remove Blackfin references in USB support 2018-03-26 15:57:16 +02:00
u_uac2.h USB: gadget: function: Remove redundant license text 2017-11-07 15:45:02 +01:00
u_uvc.h USB: gadget: function: Remove redundant license text 2017-11-07 15:45:02 +01:00
uvc.h USB: gadget: function: Remove redundant license text 2017-11-07 15:45:02 +01:00
uvc_configfs.c A couple of configfs cleanups: 2017-11-14 14:44:04 -08:00
uvc_configfs.h USB: gadget: function: Remove redundant license text 2017-11-07 15:45:02 +01:00
uvc_queue.c media: annotate ->poll() instances 2017-11-27 16:20:06 -05:00
uvc_queue.h media: annotate ->poll() instances 2017-11-27 16:20:06 -05:00
uvc_v4l2.c media: annotate ->poll() instances 2017-11-27 16:20:06 -05:00
uvc_v4l2.h USB: gadget: function: Remove redundant license text 2017-11-07 15:45:02 +01:00
uvc_video.c USB: gadget: function: Remove redundant license text 2017-11-07 15:45:02 +01:00
uvc_video.h USB: gadget: function: Remove redundant license text 2017-11-07 15:45:02 +01:00