Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp193715lqp; Tue, 11 Jun 2024 01:12:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU/l7X+hZhUCP6jlZP/Cl2RhcLiVconKyWR7CaLwphSK+NjE9scHptV3kD/9QJIe50rGzfAtQKZNcxWd9n5JdZCEhhv/8B7b0JvLAbsIw== X-Google-Smtp-Source: AGHT+IH1YT1w8vZ48jqrWLfh4ay2c38RPM/xMzElmwfX5qle2+RmwVBJemhQkD+DI5czJpZP+STp X-Received: by 2002:a05:620a:2482:b0:795:58cb:2c97 with SMTP id af79cd13be357-79558cb57fcmr903490785a.48.1718093579707; Tue, 11 Jun 2024 01:12:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718093579; cv=pass; d=google.com; s=arc-20160816; b=ASPZ6nsWbxbVNCQx0WFt4cjix7pptkiLAc32saO2rb1UvxzorI0fOEdINMpbQojlAO C8ozFCe9QmOH6mXfL0f5o4Jk35IxFRXUfdAnL4hx42b+9txTLbSAiHbN/67lu6w/w+WB viXqXrp8QscNhWXTVxskSbg4nHhg7miUTejl0CS+fo4Kzxc22uZ49nJOX1w/1jKLPhiM r9fR5bEsbuXEwSLpIlOoe2sdSpfAOIxwdo5Oahh9bOu7vuu+IPywxEEZRTidLgNCXG9i ROwj757ypWMBZpUgNjKKCpEcvcNCAKTbTeNwxlT9zopTwfA47m6ifG3WyYwBSmRDk0BV 34Lg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=1qcNpYr9SkPtRLJMkT2pD1WoLD/0+PdytNXdst5BZm8=; fh=ckgrFWUCIyBwR1lIqH8Wa63Evs0lBP3gSmfdFiWGNcQ=; b=jixNqG6Ny7yIb9m01pvLTn0Kdmor7WvQQQFXc1DrxaFT8JXZbWqSH2oEtB5E31hqQL dhu6fHJEGC8AOq+xPbFo3SD0muSL6zKTTG3pBrpQ6XNOK9Wns6GfUc9uW23kHldl4axm FfhLkxsgBKdNFOvlmHCviTxhgSHeigzDdaB0Roo8KH4Hcth7g3+kQGuxa8xAqvVhX4vC frdLAgv8mSxiEGALbB8VdJmUm4rymvErP0PiIVD7LrFIjxPUXCkWjB5HVuGJ6ju1dfaQ zz4cDkuhi9o30IhW1W2e6LrTzz3wUCAFmmSadDk8E49N4iL2oJYUp22vv1KuQ+BycCIC TQ9w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Uc5Zv05L; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-209453-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209453-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-7957792fea8si506819385a.57.2024.06.11.01.12.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 01:12:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209453-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Uc5Zv05L; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-209453-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209453-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5BB881C233D4 for ; Tue, 11 Jun 2024 08:12:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E1A01176222; Tue, 11 Jun 2024 08:12:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Uc5Zv05L" Received: from mail-qv1-f45.google.com (mail-qv1-f45.google.com [209.85.219.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81867174EFA for ; Tue, 11 Jun 2024 08:12:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718093536; cv=none; b=Ydo9Ygf/+0yUnsYiz3lFveMtE/xBXLTkbz1nKrBShJKOpRRRildJLHiL7r3ynHnIDi/0+AztTBadZrE2zCZm/BEDEY4PYrMiuw5iWsy6Cfm2/u0AFuG9g2LLM3PwFlKvHbHh3dtVs7MGGCDgkxeuJAi85d6A0zFCi1CpHt8YbgA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718093536; c=relaxed/simple; bh=hVLGmVR1HMkUx7+t5Nvw+6vPF4SbFF3ImKNPy0MAlEU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MTvz/0RNM9bXPVZg+Aglyra0m1ilpm2UuzO+Ao6neNvpb2gLgu9/1u2UtDyouteI4L7+cd5NgU7UFY0nJu1eai30UFOteHcuoTKIEivok77BaNX7yFFPIeX1BrYY1IvTD1d3zHjPkZXiwx7Xs2AAPlVj89jsTwt181xEf173iSQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=Uc5Zv05L; arc=none smtp.client-ip=209.85.219.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-qv1-f45.google.com with SMTP id 6a1803df08f44-6b06f1f9a06so12869226d6.3 for ; Tue, 11 Jun 2024 01:12:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1718093533; x=1718698333; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=1qcNpYr9SkPtRLJMkT2pD1WoLD/0+PdytNXdst5BZm8=; b=Uc5Zv05L3zx0B+t6IHfmS25NKwjWRsoWfUBKmZgHSW0INbbFCiQLjODl8S/s7aAhAo FWN5QbQzDDAZd3eut+Ei3LP47sQwcdMLIuhkK5BvAdSf+n5mjYzQ5XHdrqMvpnYRTWKr twlnQ9LiWmKCBx3g4589rrXy4rL/OxM+87O8A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718093533; x=1718698333; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1qcNpYr9SkPtRLJMkT2pD1WoLD/0+PdytNXdst5BZm8=; b=GwLGa5NagzSXCDhVnK/VuM/bT5pJ1l0C15WpqDebR8RdOwx1vC81WCbDiKNR3LIgpK Eipl9df9PVvruXv5ijyZmU5/VMnXRYSGgQijF+yn7uiA9+slmzUUVL/OxrSEo0se3kkn fqC44OWUMFSxOywPvaBQFxQp+Bsgz875KT5D9o9IQnYwi2h83wAfDxuVl3dZegCTkkDh nbXDXwF5xdgIoYK0LYE00QfjLUrpB3nPs+ay9OIAfJP4dPAWImY9I8IjCcYcA0ezVGGF IV2+TQ5FzRk2VRsHLiu8Xp7Ju27wITwc7C6rnjZKwP08NZHA9U1dpc7oBloBZba+Nh7j wHaw== X-Forwarded-Encrypted: i=1; AJvYcCXMHRwF/HwgbIyw4JbJS1KuoSSI8u1lh8kD/85Cj+nEdKpNOamrm7Crl8R8iH+I7b0Wd2PWY4KNiTqJq7StnKb9FuYKapYtlBXrCjew X-Gm-Message-State: AOJu0YyQV8NjAW6n5is5xV43s08GsChwwh3aiuQO6i17cGCPvdg57d3B w/CzWoUYwpFyutZy0mSnsfD2KhPnFkX42tisMUM+V0nyb0hmMsWZY+ck5AgOWA== X-Received: by 2002:a05:6214:3912:b0:6b0:7ba0:ef67 with SMTP id 6a1803df08f44-6b07ba0f05cmr47438746d6.31.1718093533266; Tue, 11 Jun 2024 01:12:13 -0700 (PDT) Received: from denia.c.googlers.com (123.178.145.34.bc.googleusercontent.com. [34.145.178.123]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b09039c2b9sm1548886d6.28.2024.06.11.01.12.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 01:12:12 -0700 (PDT) From: Ricardo Ribalda Date: Tue, 11 Jun 2024 08:12:08 +0000 Subject: [PATCH v5 3/4] media: uvcvideo: Avoid race condition during unregister Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240611-guenter-mini-v5-3-047b6fe5d08b@chromium.org> References: <20240611-guenter-mini-v5-0-047b6fe5d08b@chromium.org> In-Reply-To: <20240611-guenter-mini-v5-0-047b6fe5d08b@chromium.org> To: Mauro Carvalho Chehab Cc: Guenter Roeck , Tomasz Figa , Laurent Pinchart , Alan Stern , Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Sean Paul , Ricardo Ribalda , Sakari Ailus X-Mailer: b4 0.13.0 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 --- 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 375a95dd3011..8fd8250110e2 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.45.2.505.gda0bf45e8d-goog