Search Linux Wireless

Re: [PATCH 1/2] wifi: mt76: mt7996: disable beacons when going offchannel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 19.08.25 19:27, Ben Greear wrote:
On 8/13/25 05:11, Felix Fietkau wrote:
Avoid leaking beacons on unrelated channels during scanning/roc

Fixes: c56d6edebc1f ("wifi: mt76: mt7996: use emulated hardware scan support")
Reported-by: Chad Monroe <chad.monroe@xxxxxxxxxx>
Signed-off-by: Felix Fietkau <nbd@xxxxxxxx>
---
  .../net/wireless/mediatek/mt76/mt7996/mac.c   | 46 +++++++++++--------
  .../net/wireless/mediatek/mt76/mt7996/main.c  |  5 ++
  .../net/wireless/mediatek/mt76/mt7996/mcu.c   | 11 +++--
  .../wireless/mediatek/mt76/mt7996/mt7996.h    |  1 +
  4 files changed, 42 insertions(+), 21 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
index 6333a064c4f7..d3d3b96f7dd2 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
@@ -1698,17 +1698,37 @@ mt7996_wait_reset_state(struct mt7996_dev *dev, u32 state)
  static void
  mt7996_update_vif_beacon(void *priv, u8 *mac, struct ieee80211_vif *vif)
  {
-	struct ieee80211_hw *hw = priv;
+	struct ieee80211_bss_conf *link_conf;
+	struct mt7996_phy *phy = priv;
+	struct mt7996_dev *dev = phy->dev;
+	unsigned int link_id;
+
switch (vif->type) {
  	case NL80211_IFTYPE_MESH_POINT:
  	case NL80211_IFTYPE_ADHOC:
  	case NL80211_IFTYPE_AP:
-		mt7996_mcu_add_beacon(hw, vif, &vif->bss_conf);
  		break;
  	default:
-		break;
+		return;
  	}
+
+	for_each_vif_active_link(vif, link_conf, link_id) {
+		struct mt7996_vif_link *link;
+
+		link = mt7996_vif_link(dev, vif, link_id);
+		if (link->phy != phy)
+			continue;
+
+		mt7996_mcu_add_beacon(dev->mt76.hw, vif, link_conf);
+	}

Hello Felix,

We attempted to backport this into our tree, and we found that 'link'
in the code above is NULL sometimes and we were seeing crashes.  Adding
a check for null seems to have fixed it.

Possibly this does not happen in upstream code, so just FYI.

Thanks. I was made aware of the same bug in OpenWrt earlier and I've adjusted the commit in my tree accordingly.

- Felix




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux