[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240926-guenter-mini-v7-2-690441953d4a@chromium.org>
Date: Thu, 26 Sep 2024 05:49:58 +0000
From: Ricardo Ribalda <ribalda@...omium.org>
To: Mauro Carvalho Chehab <mchehab@...nel.org>
Cc: Guenter Roeck <linux@...ck-us.net>, Tomasz Figa <tfiga@...omium.org>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Alan Stern <stern@...land.harvard.edu>,
Hans Verkuil <hverkuil-cisco@...all.nl>, linux-media@...r.kernel.org,
linux-kernel@...r.kernel.org, Sean Paul <seanpaul@...omium.org>,
Ricardo Ribalda <ribalda@...omium.org>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Sergey Senozhatsky <senozhatsky@...omium.org>
Subject: [PATCH v7 2/3] media: uvcvideo: Avoid race condition during
unregister
The control events are handled asynchronously by the driver. Once the
control event are handled, the urb is re-submitted.
If we simply kill the urb, there is a chance that a control event is
waiting to be processed, which will re-submit the urb after the device is
disconnected.
Fix this by calling uvc_status_suspend(), which flushes the async
controls and kills the URB in a race-free manner.
Reviewed-by: Laurent Pinchart <laurent.pinchart@...asonboard.com>
Reviewed-by: Sergey Senozhatsky <senozhatsky@...omium.org>
Signed-off-by: Ricardo Ribalda <ribalda@...omium.org>
---
drivers/media/usb/uvc/uvc_status.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/usb/uvc/uvc_status.c b/drivers/media/usb/uvc/uvc_status.c
index e438ae5af2e8..d8d5b327693f 100644
--- a/drivers/media/usb/uvc/uvc_status.c
+++ b/drivers/media/usb/uvc/uvc_status.c
@@ -294,7 +294,7 @@ int uvc_status_init(struct uvc_device *dev)
void uvc_status_unregister(struct uvc_device *dev)
{
- usb_kill_urb(dev->int_urb);
+ uvc_status_suspend(dev);
uvc_input_unregister(dev);
}
--
2.46.1.824.gd892dcdcdd-goog
Powered by blists - more mailing lists