RE: [PATCH rtw-next v5 04/10] wifi: rtw89: protect pure_monitor_mode_vif with RCU

From: Ping-Ke Shih

Date: Sat Nov 14 2026 - 23:00:51 EST


Enver Ikromov <owner@xxxxxxxxxxxxxx> wrote:
> A following patch reads rtwdev->pure_monitor_mode_vif from
> rtw89_ops_tx(), which runs without the wiphy lock, while interface
> add/remove updates the pointer under the wiphy lock.

Did you actually have rtwdev->pure_monitor_mode_vif for the case
vif == NULL?

For wlan0 + mon0 concurrency, there is no monitor vif, no?

>
> Annotate pure_monitor_mode_vif with __rcu, convert existing readers to
> rcu_access_pointer() and rcu_dereference_protected(), and recompute
> the pointer via rtw89_recalc_pure_monitor_vif() and
> rtw89_set_pure_monitor_vif().
>
> Whereas mac80211 only creates local->monitor_sdata while no other
> interface is open, a monitor interface opened with MONITOR_FLAG_ACTIVE
> is passed directly to drv_add_interface() even alongside an active
> station or AP interface. Walking rtwdev->rtwvifs_list ensures
> pure_monitor_mode_vif is published if and only if a single monitor
> interface is the sole active driver vif, and unpublishes it with
> synchronize_rcu() before its link, port, and MAC ID are released.
>
> Signed-off-by: Enver Ikromov <owner@xxxxxxxxxxxxxx>

[..]

> @@ -241,8 +282,7 @@ static int rtw89_ops_add_interface(struct ieee80211_hw *hw,
> if (ret)
> goto unset_link;
>
> - rtwdev->pure_monitor_mode_vif = vif->type == NL80211_IFTYPE_MONITOR ?
> - rtwvif : NULL;
> + rtw89_recalc_pure_monitor_vif(rtwdev, NULL, true);

I don't see the difference from this change. For virtual monitor mode, there
is one monitor vif at most.

> rtw89_recalc_lps(rtwdev);
> return 0;
>