[PATCH] wifi: iwlegacy: 3945: protect sysfs TX power update with mutex
From: Runyu Xiao
Date: Tue Sep 29 2026 - 08:45:19 EST
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@xxxxxxxxxxxxxxx
Assisted-by: LLM
Signed-off-by: Runyu Xiao <runyu.xiao@xxxxxxxxxx>
---
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