From: Johannes Berg <johannes@sipsolutions.net>
To: Remi Pommarel <repk@triplefau.lt>,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] wifi: mac80211: Update skb's NULL key in ieee80211_tx_h_select_key()
Date: Mon, 24 Mar 2025 13:17:08 +0100 [thread overview]
Message-ID: <754c24f1b1f7d37cb616478c57a85af18d119c21.camel@sipsolutions.net> (raw)
In-Reply-To: <95269f93724a94ee0b22f8107fe5b5e8f2fbea76.1741950009.git.repk@triplefau.lt>
On Fri, 2025-03-14 at 12:04 +0100, Remi Pommarel wrote:
> The ieee80211 skb control block key (set when skb was queued) could have
> been removed before ieee80211_tx_dequeue() call. ieee80211_tx_dequeue()
> already called ieee80211_tx_h_select_key() to get the current key, but
> the latter do not update the key in skb control block in case it is
> NULL. Because some drivers actually use this key in their TX callbacks
> (e.g. ath1{1,2}k_mac_op_tx()) this could lead to the use after free
> below:
>
> BUG: KASAN: slab-use-after-free in ath11k_mac_op_tx+0x590/0x61c
> Read of size 4 at addr ffffff803083c248 by task kworker/u16:4/1440
Maybe should have a Fixes: tag?
And please also tag the subject "[PATCH wireless NN/MM]".
> +++ b/net/mac80211/tx.c
> @@ -668,6 +668,12 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
> } else if (ieee80211_is_data_present(hdr->frame_control) && tx->sta &&
> test_sta_flag(tx->sta, WLAN_STA_USES_ENCRYPTION)) {
> return TX_DROP;
> + } else {
> + /* Clear SKB CB key reference, ieee80211_tx_h_select_key()
> + * could have been called to update key info after its removal
> + * (e.g. by ieee80211_tx_dequeue()).
> + */
> + info->control.hw_key = NULL;
> }
I'm not sure this looks like the right place - should probably be done
around line 3897 before the call:
/*
* The key can be removed while the packet was queued, so need to call
* this here to get the current key.
*/
r = ieee80211_tx_h_select_key(&tx);
I'd think?
johannes
next prev parent reply other threads:[~2025-03-24 12:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-14 11:04 [PATCH 0/2] Fixes packet processes after vif is stopped Remi Pommarel
2025-03-14 11:04 ` [PATCH 1/2] wifi: mac80211: Update skb's NULL key in ieee80211_tx_h_select_key() Remi Pommarel
2025-03-24 12:17 ` Johannes Berg [this message]
2025-03-24 14:02 ` Remi Pommarel
2025-03-24 15:08 ` Remi Pommarel
2025-03-24 15:39 ` Johannes Berg
2025-03-25 11:57 ` Toke Høiland-Jørgensen
2025-03-14 11:04 ` [PATCH 2/2] wifi: mac80211: Purge vif txq in ieee80211_do_stop() Remi Pommarel
2025-03-24 12:17 ` Johannes Berg
2025-03-16 19:47 ` [PATCH 0/2] Fixes packet processes after vif is stopped Remi Pommarel
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=754c24f1b1f7d37cb616478c57a85af18d119c21.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=repk@triplefau.lt \
/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®