mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] wifi: iwlegacy: 3945: protect sysfs TX power update with mutex
@ 2026-09-29 12:33 Runyu Xiao
  2026-09-29 18:14 ` Stanislaw Gruszka
  0 siblings, 1 reply; 2+ messages in thread
From: Runyu Xiao @ 2026-09-29 12:33 UTC (permalink / raw)
  To: Stanislaw Gruszka
  Cc: David S . Miller, John W . Linville, Zhu Yi, linux-wireless,
	linux-kernel, stable, Runyu Xiao, Jianhao Xu

The sysfs tx_power store handler calls il3945_hw_reg_set_txpower(), whose
command path requires il->mutex to be held. The callback bypasses the mutex
used by the other 3945 control paths, triggering the lockdep assertion and
allowing concurrent TX power updates to race with other command or state
transitions. Serialize the update with the same mutex.

Fixes: b481de9ca074 ("[IWLWIFI]: add iwlwifi wireless drivers")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
---
 drivers/net/wireless/intel/iwlegacy/3945-mac.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlegacy/3945-mac.c b/drivers/net/wireless/intel/iwlegacy/3945-mac.c
index cbaf25062..e8cbc2993 100644
--- a/drivers/net/wireless/intel/iwlegacy/3945-mac.c
+++ b/drivers/net/wireless/intel/iwlegacy/3945-mac.c
@@ -3083,10 +3083,13 @@ il3945_store_tx_power(struct device *d, struct device_attribute *attr,
 	u32 val;
 
 	val = simple_strtoul(p, &p, 10);
-	if (p == buf)
+	if (p == buf) {
 		IL_INFO(": %s is not in decimal form.\n", buf);
-	else
+	} else {
+		mutex_lock(&il->mutex);
 		il3945_hw_reg_set_txpower(il, val);
+		mutex_unlock(&il->mutex);
+	}
 
 	return count;
 }
-- 
2.34.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-29 18:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-29 12:33 [PATCH] wifi: iwlegacy: 3945: protect sysfs TX power update with mutex Runyu Xiao
2026-09-29 18:14 ` Stanislaw Gruszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®