From: Ping-Ke Shih <pkshih@realtek.com>
To: Enver Ikromov <owner@ph4ntom-rev.uz>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH rtw-next v5 06/10] wifi: rtw89: transmit frames from monitor interfaces
Date: Mon, 16 Nov 2026 01:35:42 +0000 [thread overview]
Message-ID: <3017c874678a439c9009f1b3c3ad765d@realtek.com> (raw)
In-Reply-To: <20261113235211.1911-7-owner@ph4ntom-rev.uz>
Enver Ikromov <owner@ph4ntom-rev.uz> wrote:
> Frames injected on a monitor interface reach the driver either through
> rtw89_ops_tx() (with info->control.vif == NULL for a passive monitor,
> info->control.vif == &sdata->vif for MONITOR_FLAG_ACTIVE, or a running
> interface matched by addr2) or,
What do you want to do in this patch? Flag MONITOR_FLAG_ACTIVE, so rtw89
can handle the ACKs?
> for injected data frames whose addr2
> matches an active interface, via wake_tx_queue and
> rtw89_core_txq_push().
How can I reproduce this? I setup wlan0 + mon0 (with UP state), and
use your script to inject packet with wlan0's mac address, it still
goes via rtw89_ops_tx().
>
> Passing local->monitor_sdata directly is racy because
> ieee80211_del_virtual_monitor() calls drv_remove_interface() before
> clearing local->monitor_sdata, so mac80211 may still pass a tearing-down
> monitor vif to rtw89_ops_tx() after the driver has released its MAC ID
> and port.
The local->monitor_sdata is RCU data, and ieee80211_monitor_start_xmit()
holds rcu_read_lock(). Is it a problematic?
>
> In rtw89_ops_tx(), require an active PHY entity and resolve passive
> monitor TX through rtwdev->pure_monitor_mode_vif under rcu_read_lock(),
> while permitting concurrent MONITOR_FLAG_ACTIVE interfaces to transmit
> through their own driver vif while rtwvif->mon_tx_ready is set (clearing
> mon_tx_ready and coalescing synchronize_rcu() before teardown). Track
> active driver monitor vifs in rtwdev->monitor_vifs via
> rtw89_is_monitoring() so concurrent MONITOR_FLAG_ACTIVE interfaces
> reserve radiotap headroom and enable PHY status parsing (parsing scan
> channel IEs before pushing radiotap headers), and verify skb_headlen()
> in rtw89_core_tx_write_link() before reading skb->data.
I don't think rtwdev->monitor_vifs can be more than one. How could it
be?
>
> Signed-off-by: Enver Ikromov <owner@ph4ntom-rev.uz>
> ---
> drivers/net/wireless/realtek/rtw89/core.c | 22 ++++--
> drivers/net/wireless/realtek/rtw89/core.h | 10 ++-
> drivers/net/wireless/realtek/rtw89/mac80211.c | 71 ++++++++++++++++---
> drivers/net/wireless/realtek/rtw89/phy.c | 2 +-
> 4 files changed, 88 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
> index 9cf2b03..54605f7 100644
> --- a/drivers/net/wireless/realtek/rtw89/core.c
> +++ b/drivers/net/wireless/realtek/rtw89/core.c
> @@ -1450,6 +1450,14 @@ static int rtw89_core_tx_write_link(struct rtw89_dev *rtwdev,
> struct rtw89_core_tx_request tx_req = {};
> int ret;
>
> + if (unlikely(IEEE80211_SKB_CB(skb)->flags & IEEE80211_TX_CTL_INJECTED)) {
> + struct ieee80211_hdr *hdr = (void *)skb->data;
> +
> + if (skb_headlen(skb) < sizeof(struct ieee80211_cts) ||
> + skb_headlen(skb) < ieee80211_hdrlen(hdr->frame_control))
> + return -EINVAL;
> + }
> +
If validation is necessary, should you validate more? not only CTS?
Also, create a function to do this. I feel only rtw89_ops_tx() can be entry of
injection, please do validation there.
> tx_req.skb = skb;
> tx_req.vif = vif;
> tx_req.sta = sta;
[...]
> @@ -9323,12 +9325,18 @@ static inline struct rtw89_fw_suit *rtw89_fw_suit_get(struct rtw89_dev *rtwdev,
> return &fw_info->normal;
> }
>
> +static inline bool rtw89_is_monitoring(struct rtw89_dev *rtwdev)
> +{
> + return (rtwdev->hw->conf.flags & IEEE80211_CONF_MONITOR) ||
> + READ_ONCE(rtwdev->monitor_vifs);
The monitor_vifs > 1 is not possible, why do you need this?
The flag IEEE80211_CONF_MONITOR is cleared if both wlan0 + mon0 are UP.
Do you actually need that? I have no good idea now. Can we just focus
on single monitor case? Or just avoid crash from concurrency
combination.
next prev parent reply other threads:[~2026-11-16 1:35 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 23:52 [PATCH rtw-next v5 00/10] wifi: rtw89: monitor mode RX filter and raw frame injection fixes Enver Ikromov
2026-11-13 23:52 ` [PATCH rtw-next v5 01/10] wifi: rtw89: avoid NULL vif dereference in rtw89_ops_tx() Enver Ikromov
2026-11-15 3:23 ` Ping-Ke Shih
2026-11-16 15:27 ` Enver Ikromov
2026-11-13 23:52 ` [PATCH rtw-next v5 02/10] wifi: rtw89: handle negative rate index for injected frames Enver Ikromov
2026-11-15 3:38 ` Ping-Ke Shih
2026-11-16 15:27 ` Enver Ikromov
2026-11-13 23:52 ` [PATCH rtw-next v5 03/10] wifi: rtw89: fix RX filter configuration for monitor mode Enver Ikromov
2026-11-15 3:48 ` Ping-Ke Shih
2026-11-16 15:27 ` Enver Ikromov
2026-11-17 7:17 ` Ping-Ke Shih
2026-11-17 9:40 ` Enver Ikromov
2026-11-13 23:52 ` [PATCH rtw-next v5 04/10] wifi: rtw89: protect pure_monitor_mode_vif with RCU Enver Ikromov
2026-11-15 4:00 ` Ping-Ke Shih
2026-11-16 15:27 ` Enver Ikromov
2026-11-13 23:52 ` [PATCH rtw-next v5 05/10] wifi: rtw89: use AP self role for monitor interfaces Enver Ikromov
2026-11-15 4:08 ` Ping-Ke Shih
2026-11-16 15:27 ` Enver Ikromov
2026-11-17 0:41 ` Ping-Ke Shih
2026-11-17 9:40 ` Enver Ikromov
2026-11-13 23:52 ` [PATCH rtw-next v5 06/10] wifi: rtw89: transmit frames from " Enver Ikromov
2026-11-16 1:35 ` Ping-Ke Shih [this message]
2026-11-16 15:27 ` Enver Ikromov
2026-11-13 23:52 ` [PATCH rtw-next v5 07/10] wifi: rtw89: send injected control frames through the management path Enver Ikromov
2026-11-16 2:14 ` Ping-Ke Shih
2026-11-16 15:27 ` Enver Ikromov
2026-11-13 23:52 ` [PATCH rtw-next v5 08/10] wifi: rtw89: skip host-side TX hooks for injected frames Enver Ikromov
2026-11-16 2:20 ` Ping-Ke Shih
2026-11-16 15:28 ` Enver Ikromov
2026-11-13 23:52 ` [PATCH rtw-next v5 09/10] wifi: rtw89: honor ASSIGN_SEQ, retries, and NO_ACK " Enver Ikromov
2026-11-16 3:00 ` Ping-Ke Shih
2026-11-16 15:28 ` Enver Ikromov
2026-11-13 23:52 ` [PATCH rtw-next v5 10/10] wifi: rtw89: restore channel when leaving idle on non-chanctx devices Enver Ikromov
2026-11-16 3:45 ` Ping-Ke Shih
2026-11-16 15:28 ` Enver Ikromov
2026-11-17 4:14 ` Zong-Zhe Yang
2026-11-17 9:40 ` Enver Ikromov
2026-11-16 7:56 ` Zong-Zhe Yang
2026-11-16 15:28 ` Enver Ikromov
2026-11-15 3:12 ` [PATCH rtw-next v5 00/10] wifi: rtw89: monitor mode RX filter and raw frame injection fixes Ping-Ke Shih
2026-11-16 15:27 ` Enver Ikromov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3017c874678a439c9009f1b3c3ad765d@realtek.com \
--to=pkshih@realtek.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=owner@ph4ntom-rev.uz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.