mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Enver Ikromov <owner@ph4ntom-rev.uz>
To: Ping-Ke Shih <pkshih@realtek.com>
Cc: Zong-Zhe Yang <kevin_yang@realtek.com>,
	linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	Enver Ikromov <owner@ph4ntom-rev.uz>
Subject: [PATCH rtw-next v6 1/5] wifi: rtw89: avoid NULL vif dereference in rtw89_ops_tx()
Date: Tue, 17 Nov 2026 14:41:31 +0500	[thread overview]
Message-ID: <20261117094135.1772-2-owner@ph4ntom-rev.uz> (raw)
In-Reply-To: <20261117094135.1772-1-owner@ph4ntom-rev.uz>

Injecting a raw frame on a passive monitor interface while a station or
AP interface is also up causes a kernel NULL pointer dereference,
because mac80211 has no virtual monitor vif in concurrent mode and
passes a NULL vif to the driver TX path.

Check the vif pointer with vif_to_rtwvif_safe() and drop frames without
a vif.

Fixes: a0e97ae3f332 ("wifi: rtw89: add ieee80211::remain_on_channel ops")
Cc: stable@vger.kernel.org
Signed-off-by: Enver Ikromov <owner@ph4ntom-rev.uz>
---
 drivers/net/wireless/realtek/rtw89/mac80211.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtw89/mac80211.c b/drivers/net/wireless/realtek/rtw89/mac80211.c
index c85ea82..7a55fed 100644
--- a/drivers/net/wireless/realtek/rtw89/mac80211.c
+++ b/drivers/net/wireless/realtek/rtw89/mac80211.c
@@ -23,11 +23,16 @@ static void rtw89_ops_tx(struct ieee80211_hw *hw,
 	struct rtw89_dev *rtwdev = hw->priv;
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
 	struct ieee80211_vif *vif = info->control.vif;
-	struct rtw89_vif *rtwvif = vif_to_rtwvif(vif);
+	struct rtw89_vif *rtwvif = vif_to_rtwvif_safe(vif);
 	struct ieee80211_sta *sta = control->sta;
 	u32 flags = IEEE80211_SKB_CB(skb)->flags;
 	int ret, qsel;
 
+	if (unlikely(!rtwvif)) {
+		ieee80211_free_txskb(hw, skb);
+		return;
+	}
+
 	if (rtwvif->offchan && !(flags & IEEE80211_TX_CTL_TX_OFFCHAN) && sta) {
 		struct rtw89_sta *rtwsta = sta_to_rtwsta(sta);
 
-- 
2.56.0.windows.4


  reply	other threads:[~2026-11-17  9:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17  9:41 [PATCH rtw-next v6 0/5] wifi: rtw89: monitor mode and raw frame injection fixes Enver Ikromov
2026-11-17  9:41 ` Enver Ikromov [this message]
2026-11-17  9:41 ` [PATCH rtw-next v6 2/5] wifi: rtw89: handle negative rate index for injected frames Enver Ikromov
2026-11-17  9:41 ` [PATCH rtw-next v6 3/5] wifi: rtw89: restore channel when leaving idle on non-chanctx devices Enver Ikromov
2026-11-18  6:30   ` Zong-Zhe Yang
2026-11-17  9:41 ` [PATCH rtw-next v6 4/5] wifi: rtw89: avoid reading seq_ctrl on control frames Enver Ikromov
2026-11-17  9:41 ` [PATCH rtw-next v6 5/5] wifi: rtw89: honor ASSIGN_SEQ, retries, and NO_ACK for injected frames 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=20261117094135.1772-2-owner@ph4ntom-rev.uz \
    --to=owner@ph4ntom-rev.uz \
    --cc=kevin_yang@realtek.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pkshih@realtek.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®