Skip to contentSkip to conversation

mac80211: fix using smp_processor_id() in preemptible code in ieee80211_tx_control_port()

PATCH In review Deepanshu Kartikey 1 participant 3 messages Sep 10 – Oct 18 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: fix using smp_processor_id() in preemptible code in ieee80211_tx_control_port()

ieee80211_tx_control_port() can be called from nl80211_tx_control_port() in normal process context via netlink sendmsg(), where BH/preemption is not disabled. dev_sw_netstats_tx_add() uses this_cpu_ptr() internally, which requires preemption to be disabled, triggering a
"BUG: using smp_processor_id() in preemptible code" warning.

Fix this by moving the local_bh_disable()/local_bh_enable() section to also cover dev_sw_netstats_tx_add() and ieee80211_tpt_led_trig_tx().

Fixes d5a014204a3b ("wifi: mac80211: tx: simplify control port frame transmission")
Reported-by [email protected]
---
 net/mac80211/tx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
net/mac80211/tx.c +1 -2
index 74ab27534076..7b1a3c63e5dc 100644
@@ -6687,10 +6687,9 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
 		return -EINVAL;
 	}
 
+	local_bh_disable();
 	dev_sw_netstats_tx_add(dev, 1, skb->len);
 	ieee80211_tpt_led_trig_tx(local, skb->len);
-
-	local_bh_disable();
 	ieee80211_xmit(sdata, sta, skb);
 	local_bh_enable();
 	rcu_read_unlock();
Signature · 1 line
2.34.1
#1 lore raw
Quoted 35 lines · Deepanshu Kartikey

ieee80211_tx_control_port() can be called from nl80211_tx_control_port() in normal process context via netlink sendmsg(), where BH/preemption is not disabled. dev_sw_netstats_tx_add() uses this_cpu_ptr() internally, which requires preemption to be disabled, triggering a
"BUG: using smp_processor_id() in preemptible code" warning.

Fix this by moving the local_bh_disable()/local_bh_enable() section to also cover dev_sw_netstats_tx_add() and ieee80211_tpt_led_trig_tx().

Fixes d5a014204a3b ("wifi: mac80211: tx: simplify control port frame transmission")
Reported-by [email protected]
---
 net/mac80211/tx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
net/mac80211/tx.c +1 -3
index 74ab27534076..7b1a3c63e5dc 100644
@@ -6687,10 +6687,9 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
                return -EINVAL;
        }
 
+       local_bh_disable();
        dev_sw_netstats_tx_add(dev, 1, skb->len);
        ieee80211_tpt_led_trig_tx(local, skb->len);
-
-       local_bh_disable();
        ieee80211_xmit(sdata, sta, skb);
        local_bh_enable();
        rcu_read_unlock();
--
Quoted 2 lines

2.34.1

Gentle Reminder. Please let me know the status of this patch.

Thanks

Deepanshu

#2 lore raw
In reply to Deepanshu Kartikey
Quoted 35 lines · Deepanshu Kartikey

ieee80211_tx_control_port() can be called from nl80211_tx_control_port() in normal process context via netlink sendmsg(), where BH/preemption is not disabled. dev_sw_netstats_tx_add() uses this_cpu_ptr() internally, which requires preemption to be disabled, triggering a
"BUG: using smp_processor_id() in preemptible code" warning.

Fix this by moving the local_bh_disable()/local_bh_enable() section to also cover dev_sw_netstats_tx_add() and ieee80211_tpt_led_trig_tx().

Fixes d5a014204a3b ("wifi: mac80211: tx: simplify control port frame transmission")
Reported-by [email protected]
---
 net/mac80211/tx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
net/mac80211/tx.c +1 -3
index 74ab27534076..7b1a3c63e5dc 100644
@@ -6687,10 +6687,9 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
                return -EINVAL;
        }
 
+       local_bh_disable();
        dev_sw_netstats_tx_add(dev, 1, skb->len);
        ieee80211_tpt_led_trig_tx(local, skb->len);
-
-       local_bh_disable();
        ieee80211_xmit(sdata, sta, skb);
        local_bh_enable();
        rcu_read_unlock();
--
Quoted 2 lines

2.34.1

Gentle Reminder. Please let me know the status of this patch.

Thanks

Deepanshu