Skip to content

Commit 23b3c59

Browse files
Chih-Kang Changgregkh
authored andcommitted
wifi: rtw89: mcc: stop TX during MCC prepare
[ Upstream commit 182c7ff ] Stop TX during the MCC configuration period to prevent packet leakage. The stop time is defined as 'start_tsf - tsf', which means the duration from when MCC configuration begins until MCC starts. Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Link: https://patch.msgid.link/20250610130034.14692-6-pkshih@realtek.com Stable-dep-of: 3e31a6b ("wifi: rtw89: fix use-after-free in rtw89_core_tx_kick_off_and_wait()") Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9412977 commit 23b3c59

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed

drivers/net/wireless/realtek/rtw89/chan.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,6 +1595,35 @@ static bool rtw89_mcc_duration_decision_on_bt(struct rtw89_dev *rtwdev)
15951595
return false;
15961596
}
15971597

1598+
void rtw89_mcc_prepare_done_work(struct wiphy *wiphy, struct wiphy_work *work)
1599+
{
1600+
struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev,
1601+
mcc_prepare_done_work.work);
1602+
1603+
lockdep_assert_wiphy(wiphy);
1604+
1605+
ieee80211_wake_queues(rtwdev->hw);
1606+
}
1607+
1608+
static void rtw89_mcc_prepare(struct rtw89_dev *rtwdev, bool start)
1609+
{
1610+
struct rtw89_mcc_info *mcc = &rtwdev->mcc;
1611+
struct rtw89_mcc_config *config = &mcc->config;
1612+
1613+
if (start) {
1614+
ieee80211_stop_queues(rtwdev->hw);
1615+
1616+
wiphy_delayed_work_queue(rtwdev->hw->wiphy,
1617+
&rtwdev->mcc_prepare_done_work,
1618+
usecs_to_jiffies(config->prepare_delay));
1619+
} else {
1620+
wiphy_delayed_work_queue(rtwdev->hw->wiphy,
1621+
&rtwdev->mcc_prepare_done_work, 0);
1622+
wiphy_delayed_work_flush(rtwdev->hw->wiphy,
1623+
&rtwdev->mcc_prepare_done_work);
1624+
}
1625+
}
1626+
15981627
static int rtw89_mcc_fill_start_tsf(struct rtw89_dev *rtwdev)
15991628
{
16001629
struct rtw89_mcc_info *mcc = &rtwdev->mcc;
@@ -1630,6 +1659,8 @@ static int rtw89_mcc_fill_start_tsf(struct rtw89_dev *rtwdev)
16301659

16311660
config->start_tsf = start_tsf;
16321661
config->start_tsf_in_aux_domain = tsf_aux + start_tsf - tsf;
1662+
config->prepare_delay = start_tsf - tsf;
1663+
16331664
return 0;
16341665
}
16351666

@@ -2219,6 +2250,8 @@ static int rtw89_mcc_start(struct rtw89_dev *rtwdev)
22192250
rtw89_chanctx_notify(rtwdev, RTW89_CHANCTX_STATE_MCC_START);
22202251

22212252
rtw89_mcc_start_beacon_noa(rtwdev);
2253+
2254+
rtw89_mcc_prepare(rtwdev, true);
22222255
return 0;
22232256
}
22242257

@@ -2307,6 +2340,8 @@ static void rtw89_mcc_stop(struct rtw89_dev *rtwdev,
23072340
rtw89_chanctx_notify(rtwdev, RTW89_CHANCTX_STATE_MCC_STOP);
23082341

23092342
rtw89_mcc_stop_beacon_noa(rtwdev);
2343+
2344+
rtw89_mcc_prepare(rtwdev, false);
23102345
}
23112346

23122347
static int rtw89_mcc_update(struct rtw89_dev *rtwdev)

drivers/net/wireless/realtek/rtw89/chan.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ const struct rtw89_chan *__rtw89_mgnt_chan_get(struct rtw89_dev *rtwdev,
129129
#define rtw89_mgnt_chan_get(rtwdev, link_index) \
130130
__rtw89_mgnt_chan_get(rtwdev, __func__, link_index)
131131

132+
void rtw89_mcc_prepare_done_work(struct wiphy *wiphy, struct wiphy_work *work);
133+
132134
int rtw89_chanctx_ops_add(struct rtw89_dev *rtwdev,
133135
struct ieee80211_chanctx_conf *ctx);
134136
void rtw89_chanctx_ops_remove(struct rtw89_dev *rtwdev,

drivers/net/wireless/realtek/rtw89/core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4816,6 +4816,7 @@ void rtw89_core_stop(struct rtw89_dev *rtwdev)
48164816
wiphy_delayed_work_cancel(wiphy, &rtwdev->coex_bt_devinfo_work);
48174817
wiphy_delayed_work_cancel(wiphy, &rtwdev->coex_rfk_chk_work);
48184818
wiphy_delayed_work_cancel(wiphy, &rtwdev->cfo_track_work);
4819+
wiphy_delayed_work_cancel(wiphy, &rtwdev->mcc_prepare_done_work);
48194820
cancel_delayed_work_sync(&rtwdev->forbid_ba_work);
48204821
wiphy_delayed_work_cancel(wiphy, &rtwdev->antdiv_work);
48214822

@@ -5042,6 +5043,7 @@ int rtw89_core_init(struct rtw89_dev *rtwdev)
50425043
wiphy_delayed_work_init(&rtwdev->coex_bt_devinfo_work, rtw89_coex_bt_devinfo_work);
50435044
wiphy_delayed_work_init(&rtwdev->coex_rfk_chk_work, rtw89_coex_rfk_chk_work);
50445045
wiphy_delayed_work_init(&rtwdev->cfo_track_work, rtw89_phy_cfo_track_work);
5046+
wiphy_delayed_work_init(&rtwdev->mcc_prepare_done_work, rtw89_mcc_prepare_done_work);
50455047
INIT_DELAYED_WORK(&rtwdev->forbid_ba_work, rtw89_forbid_ba_work);
50465048
wiphy_delayed_work_init(&rtwdev->antdiv_work, rtw89_phy_antdiv_work);
50475049
rtwdev->txq_wq = alloc_workqueue("rtw89_tx_wq", WQ_UNBOUND | WQ_HIGHPRI, 0);

drivers/net/wireless/realtek/rtw89/core.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5728,6 +5728,7 @@ struct rtw89_mcc_config {
57285728
struct rtw89_mcc_sync sync;
57295729
u64 start_tsf;
57305730
u64 start_tsf_in_aux_domain;
5731+
u64 prepare_delay;
57315732
u16 mcc_interval; /* TU */
57325733
u16 beacon_offset; /* TU */
57335734
};
@@ -5858,6 +5859,7 @@ struct rtw89_dev {
58585859
struct wiphy_delayed_work coex_bt_devinfo_work;
58595860
struct wiphy_delayed_work coex_rfk_chk_work;
58605861
struct wiphy_delayed_work cfo_track_work;
5862+
struct wiphy_delayed_work mcc_prepare_done_work;
58615863
struct delayed_work forbid_ba_work;
58625864
struct wiphy_delayed_work antdiv_work;
58635865
struct rtw89_ppdu_sts_info ppdu_sts;

0 commit comments

Comments
 (0)