All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ricardo Ribalda <ribalda@chromium.org>
To: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Guenter Roeck <linux@roeck-us.net>,
	Max Staudt <mstaudt@chromium.org>,
	 Tomasz Figa <tfiga@chromium.org>,
	 Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	 Alan Stern <stern@rowland.harvard.edu>,
	 Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	linux-media@vger.kernel.org,  linux-kernel@vger.kernel.org,
	Sean Paul <seanpaul@chromium.org>,
	 Ricardo Ribalda <ribalda@chromium.org>,
	 Sakari Ailus <sakari.ailus@linux.intel.com>
Subject: [PATCH v4 3/4] media: uvcvideo: Avoid race condition during unregister
Date: Wed, 27 Mar 2024 08:24:46 +0000	[thread overview]
Message-ID: <20240327-guenter-mini-v4-3-49955c198eae@chromium.org> (raw)
In-Reply-To: <20240327-guenter-mini-v4-0-49955c198eae@chromium.org>

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.

uvc_status_suspend() flushes the async controls and stops the urb in a
correct manner.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.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 375a95dd30110..8fd8250110e2f 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.44.0.396.g6e790dbe36-goog


  parent reply	other threads:[~2024-03-27  8:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27  8:24 [PATCH v4 0/4] uvcvideo: Attempt N to land UVC race conditions fixes Ricardo Ribalda
2024-03-27  8:24 ` [PATCH v4 1/4] media: uvcvideo: stop stream during unregister Ricardo Ribalda
2024-03-27  8:24 ` [PATCH v4 2/4] media: uvcvideo: Refactor the status irq API Ricardo Ribalda
2024-03-27  8:24 ` Ricardo Ribalda [this message]
2024-03-27  8:24 ` [PATCH v4 4/4] media: uvcvideo: Exit early if there is not int_urb Ricardo Ribalda
2024-03-27 11:04 ` [PATCH v4 0/4] uvcvideo: Attempt N to land UVC race conditions fixes Sergey Senozhatsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240327-guenter-mini-v4-3-49955c198eae@chromium.org \
    --to=ribalda@chromium.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mchehab@kernel.org \
    --cc=mstaudt@chromium.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=seanpaul@chromium.org \
    --cc=stern@rowland.harvard.edu \
    --cc=tfiga@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.