From: Zhao Li <enderaoelyther@gmail.com>
To: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: [PATCH 1/3] wifi: iwlwifi: mvm: defer freeing PTK PN state on key failure
Date: Mon, 14 Sep 2026 22:54:31 +0800 [thread overview]
Message-ID: <20260914145433.42830-2-enderaoelyther@gmail.com> (raw)
In-Reply-To: <20260914145433.42830-1-enderaoelyther@gmail.com>
The PTK packet-number state is published to RCU readers before the key is
installed in firmware.
If firmware rejects the key, the error path clears the pointer and
immediately frees the state while an RX reader may still hold it.
Defer the free until after an RCU grace period, matching the normal key
removal path.
Fixes: d066a530af8e ("wifi: iwlwifi: mvm: fix ptk_pn memory leak")
Cc: stable@vger.kernel.org
Assisted-by: Codex:gpt-6-astra
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
---
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 5bd246e37943..b0c4f245c88f 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -4385,7 +4385,7 @@ static int __iwl_mvm_mac_set_key(struct ieee80211_hw *hw,
key->hw_key_idx = STA_KEY_IDX_INVALID;
if (ptk_pn) {
RCU_INIT_POINTER(mvmsta->ptk_pn[keyidx], NULL);
- kfree(ptk_pn);
+ kfree_rcu(ptk_pn, rcu_head);
}
/*
* can't add key for RX, but we don't need it
--
2.55.0
next prev parent reply other threads:[~2026-09-14 14:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 14:54 [PATCH 0/3] wifi: iwlwifi: fix RCU lifetime on setup failures Zhao Li
2026-09-14 14:54 ` Zhao Li [this message]
2026-09-14 14:54 ` [PATCH 2/3] wifi: iwlwifi: mld: defer freeing PTK PN state on key failure Zhao Li
2026-09-14 14:54 ` [PATCH 3/3] wifi: iwlwifi: mld: unpublish links before freeing on add failure Zhao Li
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=20260914145433.42830-2-enderaoelyther@gmail.com \
--to=enderaoelyther@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=miriam.rachel.korenblit@intel.com \
--cc=stable@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
all inboxes | Powered by JetHome®