linux/drivers/usb/gadget/function
Udipto Goswami 1c2e54fbf1 usb: f_fs: Clear OS Extended descriptor counts to zero in ffs_data_reset()
For userspace functions using OS Descriptors, if a function also supplies
Extended Property descriptors currently the counts and lengths stored in
the ms_os_descs_ext_prop_{count,name_len,data_len} variables are not
getting reset to 0 during an unbind or when the epfiles are closed. If
the same function is re-bound and the descriptors are re-written, this
results in those count/length variables to monotonically increase
causing the VLA allocation in _ffs_func_bind() to grow larger and larger
at each bind/unbind cycle and eventually fail to allocate.

Fix this by clearing the ms_os_descs_ext_prop count & lengths to 0 in
ffs_data_reset().

Fixes: f0175ab519 ("usb: gadget: f_fs: OS descriptors support")
Cc: stable@vger.kernel.org
Signed-off-by: Udipto Goswami <ugoswami@codeaurora.org>
Signed-off-by: Sriharsha Allenki <sallenki@codeaurora.org>
Reviewed-by: Manu Gautam <mgautam@codeaurora.org>
Link: https://lore.kernel.org/r/20200402044521.9312-1-sallenki@codeaurora.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-16 14:59:49 +02:00
..
f_acm.c usb: gadget: u_serial: allow more console gadget ports 2019-10-22 10:27:12 +03:00
f_ecm.c usb: gadget: f_ecm: Use atomic_t to track in-flight request 2020-01-15 10:40:22 +01:00
f_eem.c USB: gadget: function: fix issue Unneeded variable: "value" 2019-07-03 10:58:44 +03:00
f_fs.c usb: f_fs: Clear OS Extended descriptor counts to zero in ffs_data_reset() 2020-04-16 14:59:49 +02:00
f_hid.c USB: gadget: f_hid: fix deadlock in f_hidg_write() 2019-03-20 10:58:48 +02:00
f_loopback.c
f_mass_storage.c scsi: treewide: Consolidate {get,put}_unaligned_[bl]e24() definitions 2020-03-16 22:08:34 -04:00
f_mass_storage.h
f_midi.c
f_ncm.c usb: gadget: f_ncm: Use atomic_t to track in-flight request 2020-01-15 10:40:16 +01:00
f_obex.c usb: gadget: u_serial: make OBEX port not a console 2019-10-22 10:27:09 +03:00
f_phonet.c usb: gadget: f_phonet: Replace zero-length array with flexible-array member 2020-02-14 08:38:16 -08:00
f_printer.c
f_rndis.c usb: gadget: fix wrong endpoint desc 2019-12-10 14:56:10 +02:00
f_serial.c usb: gadget: u_serial: allow more console gadget ports 2019-10-22 10:27:12 +03:00
f_sourcesink.c usb: gadget: Potential NULL dereference on allocation error 2019-01-14 10:29:55 +02:00
f_subset.c
f_tcm.c usb: gadget: f_tcm: Provide support to get alternate setting in tcm function 2019-10-22 10:37:29 +03:00
f_uac1_legacy.c usb: gadget: remove redundant assignment to variable status 2020-02-10 11:15:27 -08:00
f_uac1.c usb: gadget: function: sync f_uac1 ac header baInterfaceNr 2019-02-07 13:14:51 +02:00
f_uac2.c
f_uvc.c media: gadget: uvc: rename VFL_TYPE_GRABBER to _VIDEO 2020-02-24 16:52:45 +01:00
f_uvc.h
g_zero.h
Makefile
ndis.h
rndis.c proc: convert everything to "struct proc_ops" 2020-02-04 03:05:26 +00:00
rndis.h
storage_common.c
storage_common.h scsi: treewide: Consolidate {get,put}_unaligned_[bl]e24() definitions 2020-03-16 22:08:34 -04:00
tcm.h
u_audio.c usb: gadget: u_audio: Fix high-speed max packet size 2020-02-11 08:45:45 +02:00
u_audio.h
u_ecm.h usb: gadget: Change Andrzej Pietrasiewicz's e-mail address 2019-02-11 11:12:29 +02:00
u_eem.h usb: gadget: Change Andrzej Pietrasiewicz's e-mail address 2019-02-11 11:12:29 +02:00
u_ether_configfs.h usb: gadget: Change Andrzej Pietrasiewicz's e-mail address 2019-02-11 11:12:29 +02:00
u_ether.c usb: Replace snprintf with scnprintf in gether_get_ifname 2019-06-20 08:53:11 +03:00
u_ether.h
u_fs.h usb: gadget: Change Andrzej Pietrasiewicz's e-mail address 2019-02-11 11:12:29 +02:00
u_gether.h usb: gadget: Change Andrzej Pietrasiewicz's e-mail address 2019-02-11 11:12:29 +02:00
u_hid.h usb: gadget: Change Andrzej Pietrasiewicz's e-mail address 2019-02-11 11:12:29 +02:00
u_midi.h usb: gadget: Change Andrzej Pietrasiewicz's e-mail address 2019-02-11 11:12:29 +02:00
u_ncm.h usb: gadget: f_ncm: Add OS descriptor support 2019-05-03 09:13:47 +03:00
u_phonet.h
u_printer.h usb: gadget: Change Andrzej Pietrasiewicz's e-mail address 2019-02-11 11:12:29 +02:00
u_rndis.h usb: gadget: Change Andrzej Pietrasiewicz's e-mail address 2019-02-11 11:12:29 +02:00
u_serial.c usb: gadget: serial: fix Tx stall after buffer overflow 2020-02-11 08:45:45 +02:00
u_serial.h usb: gadget: u_serial: allow more console gadget ports 2019-10-22 10:27:12 +03:00
u_tcm.h
u_uac1_legacy.c
u_uac1_legacy.h
u_uac1.h
u_uac2.h usb: gadget: Change Andrzej Pietrasiewicz's e-mail address 2019-02-11 11:12:29 +02:00
u_uvc.h usb: gadget: Change Andrzej Pietrasiewicz's e-mail address 2019-02-11 11:12:29 +02:00
uvc_configfs.c usb: gadget: Change Andrzej Pietrasiewicz's e-mail address 2019-02-11 11:12:29 +02:00
uvc_configfs.h usb: gadget: Change Andrzej Pietrasiewicz's e-mail address 2019-02-11 11:12:29 +02:00
uvc_queue.c
uvc_queue.h
uvc_v4l2.c media: usb/gadget/f_uvc: set device_caps in struct video_device 2019-06-05 08:47:44 -04:00
uvc_v4l2.h usb: gadget: Change Andrzej Pietrasiewicz's e-mail address 2019-02-11 11:12:29 +02:00
uvc_video.c
uvc_video.h usb: gadget: Change Andrzej Pietrasiewicz's e-mail address 2019-02-11 11:12:29 +02:00
uvc.h usb: gadget: uvc: add uvcg_warn macro 2019-01-28 12:51:30 +02:00