From: Ben Greear <greearb@candelatech.com>
To: linux-wireless <linux-wireless@vger.kernel.org>,
"Korenblit, Miriam Rachel" <miriam.rachel.korenblit@intel.com>
Subject: iwlwifi-mld: Fix fw id leak in OOM case
Date: Mon, 2 Mar 2026 15:06:48 -0800 [thread overview]
Message-ID: <02f66cee-4892-24a3-9a07-1e722fe8888f@candelatech.com> (raw)
Hello Miriam,
I believe you will want to add something like this to your driver to clear the
fw_id_to_link_sta ID in case you hit the ENOMEM case.
I have no reason to believe I am actually hitting this error case, but I saw
this questionable code while looking for reasons for the use-after-free I am hitting.
diff --git a/drivers/net/wireless/intel/iwlwifi/mld/sta.c b/drivers/net/wireless/intel/iwlwifi/mld/sta.c
index 5fb2a46241e4..de9939ad1d58 100644
--- a/drivers/net/wireless/intel/iwlwifi/mld/sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mld/sta.c
@@ -535,13 +535,19 @@ iwl_mld_add_link_sta(struct iwl_mld *mld, struct ieee80211_link_sta *link_sta)
ret = iwl_mld_allocate_link_sta_fw_id(mld, &fw_id, link_sta);
if (ret)
return ret;
if (link_sta == &link_sta->sta->deflink) {
mld_link_sta = &mld_sta->deflink;
} else {
mld_link_sta = kzalloc(sizeof(*mld_link_sta), GFP_KERNEL);
- if (!mld_link_sta)
+ if (!mld_link_sta) {
+ IWL_ERR(mld, "mld-add-link-sta, OOM, clearing fw_id_to_link_sta[%d]\n",
+ fw_id);
+ RCU_INIT_POINTER(mld->fw_id_to_link_sta[fw_id], NULL);
return -ENOMEM;
+ }
}
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
next reply other threads:[~2026-03-02 23:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-02 23:06 Ben Greear [this message]
2026-03-03 7:28 ` iwlwifi-mld: Fix fw id leak in OOM case Korenblit, Miriam Rachel
2026-03-03 14:21 ` Ben Greear
2026-03-30 6:55 ` Korenblit, Miriam Rachel
2026-03-30 14:41 ` Ben Greear
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=02f66cee-4892-24a3-9a07-1e722fe8888f@candelatech.com \
--to=greearb@candelatech.com \
--cc=linux-wireless@vger.kernel.org \
--cc=miriam.rachel.korenblit@intel.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