🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #11644

[PATCH 04/17] wifi: mac80211_hwsim: lock device for manual driver binding

#11644
From: Leon Romanovsky
Date: Thu, 05 Nov 2026 11:42
30 lines
9140 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.0
Technical Details
Message-ID: <20261105-device-trust-core-v1-4-1e536825b4eb@nvidia.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!3.eu.feeder.erje.net!feeder.erje.net!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-357267-linux-kernel-netdev=dewy.ru
References: <20261105-device-trust-core-v1-0-1e536825b4eb@nvidia.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!3.eu.feeder.erje.net!feeder.erje.net!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-357267-linux-kernel-netdev=dewy.ru
From: leon@kernel.org (Leon Romanovsky)
Newsgroups: linux.kernel.netdev
Subject: [PATCH 04/17] wifi: mac80211_hwsim: lock device for manual driver binding
Date: Thu,  5 Nov 2026 13:42:17 +0200
Organization: Usenet Network
Message-ID: <20261105-device-trust-core-v1-4-1e536825b4eb@nvidia.com>
References: <20261105-device-trust-core-v1-0-1e536825b4eb@nvidia.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3630659"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:JtIieNG7aiNsxOsnNQg7Iqw2oJE= sha256:Mx66dDVVxJCcoRmcJ9f8N0rYYiA6FX9A91lNKPTClNA=
	sha1:9wnQk0RAjeHxqM2pXDiRhGdVB0Y= sha256:odbxq3QFtDfTp20Ph0BDOdre++xgqS1t/vpvLt0Ks/o=
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 72F60112F51; Thu,  5 Nov 2026 15:03:08 +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 cn0zMS3l5goV;
	Thu,  5 Nov 2026 15:03:03 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-357267-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id C1525112F46; Thu,  5 Nov 2026 15:02:49 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id CB0872C501; Thu,  5 Nov 2026 11:45:07 +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=1793878995;
	b=V7FJFnBJMoFUDm2EyMKBlngu+dmNKyf7idgd9Cx6RAshZD/g7AMkPCU/cQEBGOWTz4/2
	 7pGdwdCEasMAMWgOVHQywBBnIBr7qL7LNXfqygseQVRuSuoloPhR7LvUFLE5ZOOiGHHwc
	 5fyUf3QP8NR4ij/xKIJqxKYaBh+4gWCnJJa3MQoqo/JHG741hlxECaec2pk0VUoYO/Spp
	 J8ODctsH3lSXa3f9iQ2QcM/802vhNqj9T6T9DKghjEczsL+kKhT66KWfg25tUjJJWUznC
	 TnsuCE52m+i3kqcBqfdkm/fSTo6Rc9zQCw5beHyL/PSPRcwvmDWqKn4/QTdWT2ILLKA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793878995;
	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=cdCM073jR/DCJh2HUDXaqMPcxaAwWF1lPqWNiB/vLUE=;
	b=TDnjip8at4l+JPwGaIo4lhOEA/bUAhXO495rUL+O3NBthbjn26CdZvE3QKN4AkwavZub
	 k4+2KeyYWBQVRnGPifPpnXtHqRw7/5UkDzLkt4xRcqYVxbzhj9DQeaP/HL2/N6LOwta9y
	 Mo9IX9qd5toVLVKwSSYxmejP08ncCBoUTgYQwvFz4kHAeTNfZGDReMNa038pIhYQ+z5tg
	 9C7QmJiy+TKENqLIxIVMl4jBnnEcS8buHy2Wh+zX2jeFkU6IlsU01LHI4KiSCZ1PRcT7p
	 uavSVMdVnMYe5L9a7XliN0t0FbOToMSTfYm45lEoWMfcZ8cf+WsvmbhexKou7QFv1Rg==
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=eT9v7SQ2;
	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 3B05660A5BC7;
	Thu,  5 Nov 2026 11:43:15 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eT9v7SQ2
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=1793878984;
	b=z0eRpH7iTBCeFdh6i65iaR5W368bz9iT0HA2HyCkFe1OZAmPpDnFzJgM7CmL2lMftu39
	 IwSrkOXPcXdE0plNXepsCStrk4lJcK3aa2Gem5ct8dZ0V4rse2Qxi2WN4K1r25Grmpbnc
	 TTpJueTJdYfUv4OkI/dXElFtA1MMv3vlIUIfIZ4IScXutseR8HmaO5P9GnsFhoD50MMgr
	 7WLKtsUmn4I/xatyPf2rZ+gZBwPSvFcG0G7XQXcbdoXSTCWaBKqh3G8I051zZHIkBS2i9
	 XM7a2GVpaMbUjlH8y3HiZUQ7MatMV6gyBpDr0vf89gNW1PhCyCay+y0F5Jrni/cKZkQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793878984;
	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=cdCM073jR/DCJh2HUDXaqMPcxaAwWF1lPqWNiB/vLUE=;
	b=dsn5bCWj1f9pte5inM8FDmMISp32FQpHI81rHX06sTIbcQ7LNtdy9m27rh70Lj5aWk3L
	 AEeqCnb7GobfMd+cXMpSVeQzzYpLavMiew4cIYfFu29LUEn9J9AJ4z7qWIGMAV6j7sj5A
	 1hNlStYU6XxNUmOcfFMZ6leM5Mvu9cxqjvpkveWMEsYEVX3Qrz4n6NA3Rf9G9z9f3VrGr
	 eSePCsKKpM1K8Vy4m5GNKWtGnIdqnSzEUHDjeA8cxtY0MGLZz8ysv92NQ+jC/BothPdps
	 b0MB+FOHKZGf+3qIBl+yd5wgEwqB+Mf0VmJmd1TYI2PtAjgZdL4hdRCkFU86TLUW8Xw==
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=eT9v7SQ2;
	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 1244B6082BFD;
	Thu,  5 Nov 2026 11:43:03 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BDD41F00A22;
	Thu,  5 Nov 2026 11:43:02 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1793878983;
	bh=cdCM073jR/DCJh2HUDXaqMPcxaAwWF1lPqWNiB/vLUE=;
	h=From:To:Cc:Subject:Date:In-Reply-To:References;
	b=eT9v7SQ2y40A5UP/390xXLrJsObRzc3AcOzfvEdORBqVDMN/q52Qniru19gINalgH
	 JGk2bwSuLsIXV5t3ZEyuFDYmjpnJlfua/IAzbcEYKlMQ5Aq5wfcSAOf0kujEuOt9ES
	 ycVUHMFg5X9C8EHHPioe1DmIKzXEePWmQnnHd/tW7Jj8oMnr2C839yipt6Zd1dwzWU
	 kPYZfW251UgxkBntPipWQEo67dbzvXXaaB5/NDGTShbtposKweytgxdFtDpGdHmU9w
	 qY8WXx8BbQRVsbYSUZ0I2vuAS6Cz6sIr3afUL4xRDWaeTsB3YrW3TBviftXA2IGvMi
	 lHmgYx8N1Gc0w==
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,
	Jason Gunthorpe <jgg@ziepe.ca>
X-Mailer: git-send-email 2.56.0
X-In-Reply-To: <20261105-device-trust-core-v1-0-1e536825b4eb@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