From: Michael Grzeschik Date: Wed, 16 Oct 2024 13:58:14 +0000 (+0200) Subject: usb: gadget: uvc: dont call usb_composite_setup_continue when not streaming X-Git-Tag: v6.13-rc1~31^2~92 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e723ebc3a9aa172ab8042382afcae310c953104d;p=thirdparty%2Fkernel%2Fstable.git usb: gadget: uvc: dont call usb_composite_setup_continue when not streaming If the streamoff call was triggered by some previous disconnect or userspace application shutdown the uvc_function_setup_continue should not be called and the state should not be overwritten. For this situation the set_alt(0) was never called and the streaming ep has no USB_GADGET_DELAYED_STATUS pending. Since the state then was already updated before we also omit the state update. Signed-off-by: Michael Grzeschik Link: https://lore.kernel.org/r/20240403-uvc_request_length_by_interval-v7-9-e224bb1035f0@pengutronix.de Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/gadget/function/uvc_v4l2.c b/drivers/usb/gadget/function/uvc_v4l2.c index a3e2ca3151017..fc9a8d31a1e98 100644 --- a/drivers/usb/gadget/function/uvc_v4l2.c +++ b/drivers/usb/gadget/function/uvc_v4l2.c @@ -555,6 +555,9 @@ uvc_v4l2_streamoff(struct file *file, void *fh, enum v4l2_buf_type type) if (ret < 0) return ret; + if (uvc->state != UVC_STATE_STREAMING) + return 0; + uvc->state = UVC_STATE_CONNECTED; uvc_function_setup_continue(uvc, 1); return 0;