From: Miri Korenblit <miriam.rachel.korenblit@intel.com>
To: linux-wireless@vger.kernel.org
Cc: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Subject: [PATCH v3 wireless-next 05/15] wifi: mac80211: Fix a kernel panic in ieee80211_encrypt_tx_skb()
Date: Sun, 3 May 2026 11:58:57 +0300 [thread overview]
Message-ID: <20260503085907.257378-2-miriam.rachel.korenblit@intel.com> (raw)
In-Reply-To: <20260503085907.257378-1-miriam.rachel.korenblit@intel.com>
From: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
skb->dev may be NULL for frames on non-netdev devices. For example, NAN
device frames after pairing. Fix it.
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
---
net/mac80211/tx.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index c18de2cb3769..933c86ca21c3 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -5355,7 +5355,7 @@ static int ieee80211_beacon_protect(struct sk_buff *skb,
int ieee80211_encrypt_tx_skb(struct sk_buff *skb)
{
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
- struct ieee80211_sub_if_data *sdata;
+ struct ieee80211_sub_if_data *sdata = NULL;
struct sk_buff *check_skb;
struct ieee80211_tx_data tx;
ieee80211_tx_result res;
@@ -5370,7 +5370,14 @@ int ieee80211_encrypt_tx_skb(struct sk_buff *skb)
__skb_queue_head_init(&tx.skbs);
__skb_queue_tail(&tx.skbs, skb);
- sdata = IEEE80211_DEV_TO_SUB_IF(skb->dev);
+ if (skb->dev)
+ sdata = IEEE80211_DEV_TO_SUB_IF(skb->dev);
+ else if (info->control.vif)
+ sdata = vif_to_sdata(info->control.vif);
+
+ if (WARN_ON(!sdata))
+ return -EINVAL;
+
tx.sdata = sdata;
tx.local = sdata->local;
res = ieee80211_tx_h_encrypt(&tx);
--
2.34.1
next prev parent reply other threads:[~2026-05-03 8:59 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-03 8:58 [PATCH v3 wireless-next 00/15] wifi: mac80211: more NAN patches Miri Korenblit
2026-05-03 8:58 ` [PATCH v3 wireless-next 01/15] wifi: mac80211: track the id of the NAN cluster we joined Miri Korenblit
2026-05-03 8:58 ` [PATCH v3 wireless-next 02/15] wifi: mac80211: allow userspace TX/RX over NAN Data interfaces Miri Korenblit
2026-05-03 8:58 ` [PATCH v3 wireless-next 03/15] wifi: mac80211: accept protected frames for NAN device Miri Korenblit
2026-05-03 8:58 ` [PATCH v3 wireless-next 04/15] wifi: mac80211: Allow setting MAC address on interface creation Miri Korenblit
2026-05-03 8:58 ` Miri Korenblit [this message]
2026-05-03 8:58 ` [PATCH v3 wireless-next 06/15] wifi: mac80211: avoid out-of-bounds access in monitor Miri Korenblit
2026-05-03 8:58 ` [PATCH v3 wireless-next 07/15] wifi: mac80211: add NAN channel evacuation support Miri Korenblit
2026-05-03 8:59 ` [PATCH v3 wireless-next 08/15] wifi: mac80211_hwsim: remove unused nan_vif struct member Miri Korenblit
2026-05-03 8:59 ` [PATCH v3 wireless-next 09/15] wifi: mac80211_hwsim: move NAN related variables into a struct Miri Korenblit
2026-05-03 8:59 ` [PATCH v3 wireless-next 10/15] wifi: mac80211_hwsim: split NAN handling into separate file Miri Korenblit
2026-05-03 8:59 ` [PATCH v3 wireless-next 11/15] wifi: mac80211_hwsim: rename and switch simulation time to boottime Miri Korenblit
2026-05-03 8:59 ` [PATCH v3 wireless-next 12/15] wifi: mac80211_hwsim: move timestamp writing later in the datapath Miri Korenblit
2026-05-03 8:59 ` [PATCH v3 wireless-next 13/15] wifi: mac80211_hwsim: register beacon timer by calculating TBTT Miri Korenblit
2026-05-03 8:59 ` [PATCH v3 wireless-next 14/15] wifi: mac80211_hwsim: refactor NAN timer handling Miri Korenblit
2026-05-03 8:59 ` [PATCH v3 wireless-next 15/15] wifi: mac80211_hwsim: switch to use TXQs Miri Korenblit
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=20260503085907.257378-2-miriam.rachel.korenblit@intel.com \
--to=miriam.rachel.korenblit@intel.com \
--cc=andrei.otcheretianski@intel.com \
--cc=linux-wireless@vger.kernel.org \
/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