Article View: linux.kernel.netdev
Article #18698[PATCH v3 01/31] wifi: mac80211_hwsim: lock device for manual driver binding
From: Leon Romanovsky
Date: Wed, 18 Nov 2026 19:26
Date: Wed, 18 Nov 2026 19:26
30 lines
9237 bytes
9237 bytes
From: Leon Romanovsky <leonro@nvidia.com>
The documented API contract for device_bind_driver() requires the device
lock. mac80211_hwsim uses it for a newly created class device with no bus,
so no automatic driver-core path can bind the device concurrently and the
missing lock was safe.
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
drivers/net/wireless/virtual/mac80211_hwsim_main.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/wireless/virtual/mac80211_hwsim_main.c b/drivers/net/wireless/virtual/mac80211_hwsim_main.c
index e53714b81ec2c..b796da3dd54b3 100644
--- a/drivers/net/wireless/virtual/mac80211_hwsim_main.c
+++ b/drivers/net/wireless/virtual/mac80211_hwsim_main.c
@@ -5769,7 +5769,9 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
goto failed_drvdata;
}
data->dev->driver = &mac80211_hwsim_driver.driver;
+ device_lock(data->dev);
err = device_bind_driver(data->dev);
+ device_unlock(data->dev);
if (err != 0) {
pr_debug("mac80211_hwsim: device_bind_driver failed (%d)\n",
err);
--
2.56.1
Technical Details
Message-ID:
<20261118-device-trust-core-v3-1-d655875c4bfb@nvidia.com>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-sfo.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366374-linux-kernel-netdev=dewy.ruReferences:
<20261118-device-trust-core-v3-0-d655875c4bfb@nvidia.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-sfo.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366374-linux-kernel-netdev=dewy.ru From: leon@kernel.org (Leon Romanovsky) Newsgroups: linux.kernel.netdev Subject: [PATCH v3 01/31] wifi: mac80211_hwsim: lock device for manual driver binding Date: Wed, 18 Nov 2026 21:26:31 +0200 Organization: Usenet Network Message-ID: <20261118-device-trust-core-v3-1-d655875c4bfb@nvidia.com> References: <20261118-device-trust-core-v3-0-d655875c4bfb@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2680103"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:dDCcpCYKHBk9Eu3E79Q7XZgkCvA= sha256:5GRmPYYephkUXYlx4E9LW4uTPaOUgApQqQmd/1m8Z6w= sha1:F9774NCeyOZ3PMcbD8ttELbPEco= sha256:OAdBMIpMkQamsH6OnP5UMnvsf2CH4f7P/h2EILcU9b8= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 1F9C9115390; Wed, 18 Nov 2026 22:28:14 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -2.301 X-Spam-Status: No, score=-2.301 tagged_above=-9999 required=6.31 tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id o2lEO4mDWuMj; Wed, 18 Nov 2026 22:28:11 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-366374-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 09C15115385; Wed, 18 Nov 2026 22:27:57 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id A58C6124B6A; Wed, 18 Nov 2026 19:27:51 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795030047; b=38iKpQoG1mAGyZzi3OcgSVRk0gvbU0ZP5TlXrn4FIHzI0nK9cZa/Zb35Ti9NbqhgTCMe 75Gr/BfliRgXfHkZvFYk/YAnq9UEGdACyXLh9Aa/3xMenhMS/KYlCthj0VJcPeizUZ6aG JxbvNQlnZDk8pi7pG4eYFxW/G1MQreNaMrHbkmr/ti7Pu97zgYb0KADFRdxZQEmT62InL JEu6eTbLGHRr9hBiJ1GL37/gP+TjcJzYt97tf2w3BQ4ih0XuFNzriBIdIimTwumjXSL3d GP+3oInNC4Y2CxEuzDrO4jMgtyXrAWWRg9Xp5RhtAys1W8r9HE9LkUV6o8PfRGUfFrQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795030047; h=X-Original-To:Received:Received:DKIM-Signature:From:To:Cc:Subject: Date:Message-ID:X-Mailer:In-Reply-To:References:X-Mailing-List: List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe: List-Owner:Precedence:MIME-Version:Content-Type:X-Mailer: Content-Transfer-Encoding; bh=0q1TynGssykC2LOKqTJCRLWewJrYt+Qms+Y+NUNnNmQ=; b=ERf3GlZ7Y+1YDvt4IJG45vqjrYUAfjHXElcPA0vI0UJVi5Sh6Xp5hVhvidsbZwrosQzY N8xUcdDZiGFWMQNTdAyP03auLj0vAFHTruxTw5Emf73cHXtWTwZkZfUh1PWsQGQK3Zcrg u7+TNvsex6p90UwDAmIf1GhTU7cSRq8dhf4MTdrK/g3J3xJ9nc1RtC4LK4mt5ljRzT/x3 tvzYQDDV5K08HyP5B5IxJlLIK4FTGl4bu0cmWq0mPoA3mCx91mbelUYz5Vf3gyEcIPH9i VxygvXvV5/IWSRPg+uUCAP2WmXeeinCYQQJkQRcdvYXeCB74oE6gvbw+4BUhg8gTXYA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hiMBpwfr; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5EC6160A3803; Wed, 18 Nov 2026 19:27:27 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hiMBpwfr X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795030041; b=g1siZkCJyv4OVol72kNWjIusG+YY3qwRZrdsX1ZKlrXIbZn0dcoUH1KObXJPpc/I3Fp+ m9R+WdEduNDfd5dFfDkq2AL61DybczyULxjZtPfhJuOzXyz/UOLMCGgkHeFtV1ImytiqW 2ocvDP19JyqxrrNoEP6nw2pzK5iTZNpdFyLbTpzBkjYWjwMktBP6leWYUeSqJigF1v427 oHSAFNwUHwxDT92yCjdWb4kMVS98cTr/6xPKQO5EKRxga+jJbE35senT4IDPbQzqf5sPy v2n3+gyVg1cErIhusHpCHLLUq2ko03dzLLQJa6ZdDdzyOSwoxbMVSpTs5Z2zx7hZHNQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795030041; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Type:X-Mailer: Content-Transfer-Encoding; bh=0q1TynGssykC2LOKqTJCRLWewJrYt+Qms+Y+NUNnNmQ=; b=XmaBCmmsF32ng43C+VzTTbxeWkhNOcQBW46JsKTZiPsZZEevsvVwkr54B8gniOzpyjU3 8oyD9WVl8Pt44y7lm//LNEmZyDiKFriL0ipT6nu8X7WuAecQjuwRjJGoM4Ks32oRQcWGI Se/kYae0pU1zNtduZxbpZ0n0XwOekmNs0alIML7h3e0Az8gG9VUg0Wi3J3KGZDmdUPlCQ 89SWrweU1TNjqVAS3lFw0Js6cC6YfT+ibIRPj1jPe0SRR9pqJ4eiwVf4HDAcYwZ64d+qj Hn97EOLmFViuqOWbHp/r7gbYeMxSzS7JST+iUd3LRLwJ7VRvG1MxqLkXkxquSjIXiLA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hiMBpwfr; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78562606A325; Wed, 18 Nov 2026 19:27:21 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6729A1F000C6; Wed, 18 Nov 2026 19:27:20 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795030041; bh=0q1TynGssykC2LOKqTJCRLWewJrYt+Qms+Y+NUNnNmQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=hiMBpwfrjl85DWLJPdGsFdo1dx3SonbuhvpM6QUiy9ACYFdkJKsr806pKMwu6EGdf uttd5jCD7Fe2XyIoXYkc8QrqK3NDRUwxmXQai8YBKkElcdnCigyMNObTNkgUDmWjPg hwuG7wZn1VoQ1RaA5WDxeVd/Ip9YQ7UTxRQQBiuHp+A7i+NFqZgIagSKpVzhzf2hwC +KW7PRUmk8Xiaijkpad2QvLUghhmudE6WxVLsz3+7UNKlMnXim598zK7am1ZuulVAw Ygt0OutVArPGmZ0uVeF5/dCPE782AS9a/3fKGF4hpxYalDvW6oFNPIRA72gJPnNkwA 3vGL4GVfqZeZA== X-Cc: linux-kernel@vger.kernel.org, driver-core@lists.linux.dev, linux-input@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-usb@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-acpi@vger.kernel.org, linux-doc@vger.kernel.org, linux-pci@vger.kernel.org, iommu@lists.linux.dev, linux-coco@lists.linux.dev, Alexey Kardashevskiy <aik@amd.com>, Luiz Augusto von Dentz <luiz.von.dentz@intel.com>, Greg Kroah-Hartman <gregkh@suse.de>, linux-sound@vger.kernel.org, Jason Gunthorpe <jgg@ziepe.ca> X-Mailer: git-send-email 2.56.1 X-In-Reply-To: <20261118-device-trust-core-v3-0-d655875c4bfb@nvidia.com> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-Mailer: b4 0.15-dev-18f8f