public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Ben Greear <greearb@candelatech.com>
To: "Korenblit, Miriam Rachel" <miriam.rachel.korenblit@intel.com>,
	linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: iwlwifi-mld: Fix fw id leak in OOM case
Date: Tue, 3 Mar 2026 06:21:21 -0800	[thread overview]
Message-ID: <495b7e8d-454c-4c0f-8976-c31fcee0783d@candelatech.com> (raw)
In-Reply-To: <DM3PPF63A6024A927179DD5C6D8BEB45B11A37FA@DM3PPF63A6024A9.namprd11.prod.outlook.com>

On 3/2/26 23:28, Korenblit, Miriam Rachel wrote:
> 
> 
>> -----Original Message-----
>> From: Ben Greear <greearb@candelatech.com>
>> Sent: Tuesday, March 3, 2026 1:07 AM
>> 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
>>
>> 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
> 
> Please send a patch

Are you fine with having IWL_ERR in the patch like I have above?

Thanks,
Ben

> 

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


  reply	other threads:[~2026-03-03 14:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-02 23:06 iwlwifi-mld: Fix fw id leak in OOM case Ben Greear
2026-03-03  7:28 ` Korenblit, Miriam Rachel
2026-03-03 14:21   ` Ben Greear [this message]
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=495b7e8d-454c-4c0f-8976-c31fcee0783d@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