wifi: mac80211_hwsim: Prevent tsf from setting if beacon is disabled
authorEdward Adam Davis <eadavis@qq.com>
Wed, 23 Apr 2025 14:15:53 +0000 (22:15 +0800)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 25 Apr 2025 09:25:22 +0000 (11:25 +0200)
Setting tsf is meaningless if beacon is disabled, so check that beacon
is enabled before setting tsf.

Reported-by: syzbot+064815c6cd721082a52a@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=064815c6cd721082a52a
Tested-by: syzbot+064815c6cd721082a52a@syzkaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
Link: https://patch.msgid.link/tencent_3609AC2EFAAED68CA5A7E3C6D212D1C67806@qq.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/virtual/mac80211_hwsim.c

index 74d037c..f6add19 100644 (file)
@@ -1229,6 +1229,11 @@ static void mac80211_hwsim_set_tsf(struct ieee80211_hw *hw,
        /* MLD not supported here */
        u32 bcn_int = data->link_data[0].beacon_int;
        u64 delta = abs(tsf - now);
+       struct ieee80211_bss_conf *conf;
+
+       conf = link_conf_dereference_protected(vif, data->link_data[0].link_id);
+       if (conf && !conf->enable_beacon)
+               return;
 
        /* adjust after beaconing with new timestamp at old TBTT */
        if (tsf > now) {