Article View: linux.kernel.netdev
Article #26315[PATCH v5 01/33] wifi: mac80211_hwsim: lock device for manual driver binding
From: Leon Romanovsky
Date: Thu, 03 Dec 2026 12:03
Date: Thu, 03 Dec 2026 12:03
30 lines
9340 bytes
9340 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 e53714b81ec2..b796da3dd54b 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:
<20261203-device-trust-core-v5-1-485cc6eddd46@nvidia.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376536-linux-kernel-netdev=dewy.ruReferences:
<20261203-device-trust-core-v5-0-485cc6eddd46@nvidia.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376536-linux-kernel-netdev=dewy.ru From: leon@kernel.org (Leon Romanovsky) Newsgroups: linux.kernel.netdev Subject: [PATCH v5 01/33] wifi: mac80211_hwsim: lock device for manual driver binding Date: Thu, 3 Dec 2026 14:03:23 +0200 Organization: Usenet Network Message-ID: <20261203-device-trust-core-v5-1-485cc6eddd46@nvidia.com> References: <20261203-device-trust-core-v5-0-485cc6eddd46@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2479683"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:bnn6Jmc7zXasg4RCfraIlBY4AfE= sha256:9YHxhXnzkUXVZCSiuyvPuj5mSwSb+HnQZouuxQXJhB0= sha1:kJYjpro5NlWTftJ6sGLggFwUSdA= sha256:McZAbJJCkDOh65SRiuqBHlpUNcWW91CMH7aM84YI1ug= 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 8B6EA117903; Thu, 3 Dec 2026 15:04:45 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -2.64 X-Spam-Status: No, score=-2.64 tagged_above=-9999 required=6.31 tests=[DCC_CHECK=1.1, DKIMWL_WL_HIGH=-0.24, 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 qd9XSE5J1Io5; Thu, 3 Dec 2026 15:04:43 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-376536-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 3BBB1117900; Thu, 3 Dec 2026 15:04:34 +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 BBE6529153; Thu, 3 Dec 2026 12:04:24 +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=1796299452; b=BgiWWiinA5lkjfd0JNrVI/+wi8Jur2xCLpTLqSI77Nq8KqCAvuF+9OddV6P9xuF2MAmY xJjHi7Z5w/b2r1KroWj6/ugzZR3iKrDLaxexJjAxIMo/yUYZv34Nfkg7RZwkTLt+zhiek 9m4tM5KhbGq4PeOmyvEYVkeBDEM6LgElmV2lWLCh2MpjfRg65h4wBoFgwZ/a8PgK2KgwO MjRrx178K+UgYtf4m07j0j3kxOQ93LgNT2mfsAK/wS5eA/DQdf2SzeBkBDguia5+LsRZW Wjv3cj6MHv17+r997SjyHWHbBcftEqIFnXRXCxV/CahJ1pv39O12zkGZFvA6jvPQGrg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796299452; 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=qKjX30Xmh8c2by62qg+aIN48fEu7Q38irWMe/W+dWzU=; b=jUXPI5hafPFLMBXu3D6zW+b9UVdS+NbUczD92Ns2Xjcua9CWqhv6pWlgux0EOVwFVO/d 5yucCor1HpU4g8BveDXGBmpvBrwyMRjgqYXO6SPJMp8smnj+aICoU0n8iUoK4k0blccdj +q4fQpCuM71EfQArF0hJIW0UoQblSqUq7aUyLTNOZvk1AjqLbg4aVx/DLdK46pQP7ymKt UVhuOpuU4JndSu9rNVlVL6JcdTGCccikQWclPtPCOjVFBQCmHDovyWxqCOCEUTFcMiIEo KxO81dWlPsQBAWJnx0jYP92KPW7avOr4cHE6E0TCLvp4ZxF7fwGEgIy4hzlRXHRxt6g== 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=jwpwALwT; 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 B4FC7606A32C; Thu, 3 Dec 2026 12:04:12 +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=jwpwALwT 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=1796299446; b=18WHMuZrQWB6bm1CfgJ9SlNOfSiYCleAfoz/n+sD/PEnwQsSlGwEhkM9qeZtC8Y4Ye8L M6unHY+BlNrH3wNupqsq5vqhpLrqk1TaT3XexPLU6bWZcwtnt8I3W3MqloyA7futa1h1N 88R//t6WiEHyNJjt0pSc2g6BZGTAqjR/XwCSpO95zXJk7br2tY88SIzc5n1ERdtVd4/mZ lhDJ4rWsDbu5RH6D/+b3ay4McqjhrPWI+PzzQ7RVtJTWezaWIi0VS+QXUe0PQ0OE1uGkT jfaZL+b55hXCVAr6jpe3zAoYA/EyeU6gtrJ+bvyOnzuqPYZV+yPqrEcZyX0bmfQ4wjA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796299446; 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=qKjX30Xmh8c2by62qg+aIN48fEu7Q38irWMe/W+dWzU=; b=GrUnLtKctoTuMMrkk0w+JGEPwoMlnrQiL1ormvQ7w6CFOYaUjLJyPFF1UzP30Vxqbw3Q i3ZLvx/tI6VfEM8uk3ZlBd/wNA+QWV31C9V7q+rJ4JWstse8UX/JDRn5AwVLy0k+OvYeb 4Wk5SOGf9aHdkk9C+HMlRsHhye4e0VpX5+533zvrcxLqvD7g9r6B7tw7y3p6CqIs8fysd EgQgYkAxMPk5Z6y5ZPz55lBm+O8e+35NUSiFstoQ+j3VpJJgLdE3Tip865Mb03MnX8NLH lzlCF2dZZUWSkK9WworwlNiZXonP8EYjBDdZGFlVflBwC4enqP34G5mHJ8XbwSFleRA== 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=jwpwALwT; 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 D0A67606A32D; Thu, 3 Dec 2026 12:04:06 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0F1D1F00898; Thu, 3 Dec 2026 12:04:05 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796299446; bh=qKjX30Xmh8c2by62qg+aIN48fEu7Q38irWMe/W+dWzU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=jwpwALwT5Kq09/aKmUIoBVq4X5jrB5/BF2JcI9Q01tj4TWTyCy/6+HXCptod/99Cc 3Z1vzgaKeTIfwdUSk5TeTtIQKmODJXr6RASklw5s+HiSBsJNDlJ4KvGNrfnKqDJlvt IGvh9DukxsjpaIm1GrMnSRyTAem8KWnvTGIMikKnYr8WWPE0uMF1VrXIM7dYEK57xz auYsPTLd07QABYRP6hp1GgTFSlJN1irTW3iRELvQ2LNP3oVev89m7JfLRv46yDK/mE 2ElXZq7mhuB2xtmUAqN5AqWbgMJF68PM7knTqpYWfPuApYxnXg6xGBOqCg2WkF/+ui X50rSVSCvK8dw== 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: <20261203-device-trust-core-v5-0-485cc6eddd46@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.17-dev-d2b70