wifi: mac80211_hwsim: Prevent tsf from setting if beacon is disabled

[ Upstream commit c575f5374be7a5c4be4acb9fe6be3a4669d94674 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Edward Adam Davis
2025-04-23 22:15:53 +08:00
committed by Greg Kroah-Hartman
parent 2077cef44d
commit 4fc2b3c065

View File

@@ -1201,6 +1201,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) {