Dan Vacura
4962e5a2f3
usb: gadget: uvc: allow for application to cleanly shutdown
...
commit b81ac4395bbeaf36e078dea1a48c02dd97b76235 upstream.
Several types of kernel panics can occur due to timing during the uvc
gadget removal. This appears to be a problem with gadget resources being
managed by both the client application's v4l2 open/close and the UDC
gadget bind/unbind. Since the concept of USB_GADGET_DELAYED_STATUS
doesn't exist for unbind, add a wait to allow for the application to
close out.
Some examples of the panics that can occur are:
<1>[ 1147.652313] Unable to handle kernel NULL pointer dereference at
virtual address 0000000000000028
<4>[ 1147.652510] Call trace:
<4>[ 1147.652514] usb_gadget_disconnect+0x74/0x1f0
<4>[ 1147.652516] usb_gadget_deactivate+0x38/0x168
<4>[ 1147.652520] usb_function_deactivate+0x54/0x90
<4>[ 1147.652524] uvc_function_disconnect+0x14/0x38
<4>[ 1147.652527] uvc_v4l2_release+0x34/0xa0
<4>[ 1147.652537] __fput+0xdc/0x2c0
<4>[ 1147.652540] ____fput+0x10/0x1c
<4>[ 1147.652545] task_work_run+0xe4/0x12c
<4>[ 1147.652549] do_notify_resume+0x108/0x168
<1>[ 282.950561][ T1472] Unable to handle kernel NULL pointer
dereference at virtual address 00000000000005b8
<6>[ 282.953111][ T1472] Call trace:
<6>[ 282.953121][ T1472] usb_function_deactivate+0x54/0xd4
<6>[ 282.953134][ T1472] uvc_v4l2_release+0xac/0x1e4
<6>[ 282.953145][ T1472] v4l2_release+0x134/0x1f0
<6>[ 282.953167][ T1472] __fput+0xf4/0x428
<6>[ 282.953178][ T1472] ____fput+0x14/0x24
<6>[ 282.953193][ T1472] task_work_run+0xac/0x130
<3>[ 213.410077][ T29] configfs-gadget gadget: uvc: Failed to queue
request (-108).
<1>[ 213.410116][ T29] Unable to handle kernel NULL pointer
dereference at virtual address 0000000000000003
<6>[ 213.413460][ T29] Call trace:
<6>[ 213.413474][ T29] uvcg_video_pump+0x1f0/0x384
<6>[ 213.413489][ T29] process_one_work+0x2a4/0x544
<6>[ 213.413502][ T29] worker_thread+0x350/0x784
<6>[ 213.413515][ T29] kthread+0x2ac/0x320
<6>[ 213.413528][ T29] ret_from_fork+0x10/0x30
Signed-off-by: Dan Vacura <w36195@motorola.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220503201039.71720-1-w36195@motorola.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-05-18 10:26:57 +02:00
..
2022-02-16 12:56:37 +01:00
2022-05-09 09:14:41 +02:00
2022-01-27 11:04:09 +01:00
2022-04-27 14:38:58 +02:00
2022-03-23 09:16:41 +01:00
2022-03-08 19:12:47 +01:00
2022-05-18 10:26:53 +02:00
2022-05-01 17:22:22 +02:00
2022-04-08 14:23:41 +02:00
2022-05-09 09:14:37 +02:00
2022-04-13 20:59:13 +02:00
2022-05-09 09:14:37 +02:00
2022-04-08 14:23:09 +02:00
2022-05-09 09:14:37 +02:00
2022-04-08 14:23:55 +02:00
2022-04-08 14:23:30 +02:00
2022-04-08 14:23:31 +02:00
2022-04-27 14:38:58 +02:00
2022-05-18 10:26:57 +02:00
2022-04-27 14:38:57 +02:00
2022-05-12 12:30:05 +02:00
2022-04-20 09:34:09 +02:00
2022-04-08 14:23:44 +02:00
2022-05-12 12:30:22 +02:00
2022-05-18 10:26:57 +02:00
2022-04-08 14:22:50 +02:00
2022-04-08 14:23:31 +02:00
2022-01-27 11:04:31 +01:00
2022-04-20 09:34:16 +02:00
2022-05-18 10:26:51 +02:00
2022-04-08 14:22:50 +02:00
2022-04-20 09:34:21 +02:00
2022-03-08 19:12:37 +01:00
2022-05-09 09:14:31 +02:00
2022-05-18 10:26:52 +02:00
2022-04-27 14:38:58 +02:00
2022-05-18 10:26:53 +02:00
2022-05-18 10:26:52 +02:00
2022-04-13 20:59:28 +02:00
2022-03-16 14:23:36 +01:00
2022-01-27 11:04:21 +01:00
2022-04-08 14:24:10 +02:00
2022-04-20 09:34:20 +02:00
2022-04-20 09:34:09 +02:00
2022-05-09 09:14:34 +02:00
2022-04-08 14:23:43 +02:00
2022-05-09 09:14:44 +02:00
2022-05-12 12:30:26 +02:00
2022-05-09 09:14:41 +02:00
2022-05-18 10:26:56 +02:00
2022-05-12 12:30:10 +02:00
2022-03-08 19:12:44 +01:00
2022-04-08 14:23:48 +02:00
2022-04-27 14:38:57 +02:00
2022-03-02 11:48:06 +01:00
2022-03-08 19:12:41 +01:00
2022-04-13 20:59:11 +02:00
2022-04-13 20:59:14 +02:00
2022-05-12 12:30:34 +02:00
2022-01-27 11:04:02 +01:00
2022-04-27 14:39:00 +02:00
2022-05-09 09:14:34 +02:00
2022-05-09 09:14:36 +02:00
2022-05-18 10:26:48 +02:00
2022-04-13 20:59:05 +02:00
2022-04-08 14:23:44 +02:00
2022-04-13 20:59:01 +02:00
2022-04-08 14:23:44 +02:00
2022-04-20 09:34:16 +02:00
2022-04-08 14:23:47 +02:00
2022-04-27 14:38:55 +02:00
2022-02-01 17:27:07 +01:00
2022-04-13 20:59:26 +02:00
2022-05-18 10:26:50 +02:00
2022-04-27 14:38:58 +02:00
2022-05-18 10:26:55 +02:00
2022-04-20 09:34:21 +02:00
2022-04-08 14:24:02 +02:00
2022-05-01 17:22:27 +02:00
2022-04-13 20:59:11 +02:00
2022-04-20 09:34:15 +02:00
2022-03-02 11:47:51 +01:00
2022-05-09 09:14:42 +02:00
2022-01-27 11:04:36 +01:00
2022-05-18 10:26:55 +02:00
2022-05-18 10:26:57 +02:00
2022-04-13 20:59:15 +02:00
2022-04-20 09:34:13 +02:00
2022-04-13 20:59:07 +02:00
2022-05-18 10:26:49 +02:00
2022-04-08 14:23:50 +02:00
2022-03-16 14:23:43 +01:00
2022-04-13 20:59:11 +02:00
2022-04-08 14:24:11 +02:00
2022-04-08 14:24:17 +02:00