OrangePi_CM5/drivers/usb/gadget/function
Dan Vacura 6c3da0e19c usb: gadget: uvc: Fix crash when encoding data for usb request
commit 71d471e3faf90c9674cadc7605ac719e82cb7fac upstream.

During the uvcg_video_pump() process, if an error occurs and
uvcg_queue_cancel() is called, the buffer queue will be cleared out, but
the current marker (queue->buf_used) of the active buffer (no longer
active) is not reset. On the next iteration of uvcg_video_pump() the
stale buf_used count will be used and the logic of min((unsigned
int)len, buf->bytesused - queue->buf_used) may incorrectly calculate a
nbytes size, causing an invalid memory access.

[80802.185460][  T315] configfs-gadget gadget: uvc: VS request completed
with status -18.
[80802.185519][  T315] configfs-gadget gadget: uvc: VS request completed
with status -18.
...
uvcg_queue_cancel() is called and the queue is cleared out, but the
marker queue->buf_used is not reset.
...
[80802.262328][ T8682] Unable to handle kernel paging request at virtual
address ffffffc03af9f000
...
...
[80802.263138][ T8682] Call trace:
[80802.263146][ T8682]  __memcpy+0x12c/0x180
[80802.263155][ T8682]  uvcg_video_pump+0xcc/0x1e0
[80802.263165][ T8682]  process_one_work+0x2cc/0x568
[80802.263173][ T8682]  worker_thread+0x28c/0x518
[80802.263181][ T8682]  kthread+0x160/0x170
[80802.263188][ T8682]  ret_from_fork+0x10/0x18
[80802.263198][ T8682] Code: a8c12829 a88130cb a8c130

Fixes: d692522577 ("usb: gadget/uvc: Port UVC webcam gadget to use videobuf2 framework")
Cc: <stable@vger.kernel.org>
Signed-off-by: Dan Vacura <w36195@motorola.com>
Link: https://lore.kernel.org/r/20220331184024.23918-1-w36195@motorola.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-05-09 09:04:58 +02:00
..
Makefile
…
f_acm.c
…
f_ecm.c
…
f_eem.c
…
f_fs.c usb: f_fs: Fix use-after-free for epfile 2022-02-16 12:54:23 +01:00
f_hid.c
…
f_loopback.c
…
f_mass_storage.c
…
f_mass_storage.h
…
f_midi.c
…
f_ncm.c
…
f_obex.c
…
f_phonet.c
…
f_printer.c
…
f_rndis.c
…
f_serial.c
…
f_sourcesink.c usb: gadget: f_sourcesink: Fix isoc transfer for USB_SPEED_SUPER_PLUS 2022-02-01 17:25:41 +01:00
f_subset.c
…
f_tcm.c
…
f_uac1.c
…
f_uac1_legacy.c
…
f_uac2.c usb: gadget: f_uac2: Define specific wTerminalType 2022-02-16 12:54:29 +01:00
f_uvc.c
…
f_uvc.h
…
g_zero.h
…
ndis.h
…
rndis.c usb: gadget: rndis: prevent integer overflow in rndis_set_response() 2022-03-23 09:13:29 +01:00
rndis.h usb: gadget: rndis: add spinlock for rndis response list 2022-03-02 11:42:54 +01:00
storage_common.c
…
storage_common.h
…
tcm.h
…
u_audio.c
…
u_audio.h
…
u_ecm.h
…
u_eem.h
…
u_ether.c
…
u_ether.h
…
u_ether_configfs.h
…
u_fs.h
…
u_gether.h
…
u_hid.h
…
u_midi.h
…
u_ncm.h
…
u_phonet.h
…
u_printer.h
…
u_rndis.h
…
u_serial.c
…
u_serial.h
…
u_tcm.h
…
u_uac1.h
…
u_uac1_legacy.c
…
u_uac1_legacy.h
…
u_uac2.h
…
u_uvc.h
…
uvc.h
…
uvc_configfs.c
…
uvc_configfs.h
…
uvc_queue.c usb: gadget: uvc: Fix crash when encoding data for usb request 2022-05-09 09:04:58 +02:00
uvc_queue.h
…
uvc_v4l2.c
…
uvc_v4l2.h
…
uvc_video.c
…
uvc_video.h
…