Commit 5cd40366 authored by Avichal Rakesh's avatar Avichal Rakesh
Browse files

FROMGIT: usb: gadget: uvc: prevent use of disabled endpoint

Currently the set_alt callback immediately disables the endpoint and queues
the v4l2 streamoff event. However, as the streamoff event is processed
asynchronously, it is possible that the video_pump thread attempts to queue
requests to an already disabled endpoint.

This change moves disabling usb endpoint to the end of streamoff event
callback. As the endpoint's state can no longer be used, video_pump is
now guarded by uvc->state as well. To be consistent with the actual
streaming state, uvc->state is now toggled between CONNECTED and STREAMING
from the v4l2 event callback only.

Link: https://lore.kernel.org/20230615171558.GK741@pendragon.ideasonboard.com/
Link: https://lore.kernel.org/20230531085544.253363-1-dan.scally@ideasonboard.com/


Reviewed-by: default avatarDaniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: default avatarMichael Grzeschik <m.grzeschik@pengutronix.de>
Tested-by: default avatarMichael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: default avatarAvichal Rakesh <arakesh@google.com>
Link: https://lore.kernel.org/r/20231109004104.3467968-1-arakesh@google.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 314030607
Bug: 296925310
(cherry picked from commit 991544dc
 https://kernel.googlesource.com/pub/scm/linux/kernel/git/gregkh/usb

 usb-next)
Signed-off-by: default avatarAvichal Rakesh <arakesh@google.com>
(cherry picked from https://android-review.googlesource.com/q/commit:86d2f598a321fa8258c4f4f5aae4a0e9477d8420)
Merged-In: Ic5631a526e72cbcf299dcb8167bb3d34468d37e9
Change-Id: Ic5631a526e72cbcf299dcb8167bb3d34468d37e9
parent 4a173843
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment