From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Pavel Machek <pavel@ucw.cz>
Cc: 王明-软件底层技术部 <machel@vivo.com>,
"Ajay Singh" <ajay.kathat@microchip.com>,
"Claudiu Beznea" <claudiu.beznea@microchip.com>,
"Kalle Valo" <kvalo@kernel.org>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"opensource.kernel" <opensource.kernel@vivo.com>
Subject: Re: [PATCH net v2] net: wireless: Use kfree_sensitive instead of kfree
Date: Thu, 20 Jul 2023 15:25:38 +0200 [thread overview]
Message-ID: <2023072020-epilepsy-duchess-0a80@gregkh> (raw)
In-Reply-To: <ZLj5HPT2y8cRhWnC@duo.ucw.cz>
On Thu, Jul 20, 2023 at 11:06:36AM +0200, Pavel Machek wrote:
> Hi!
>
> > > diff --git a/drivers/net/wireless/microchip/wilc1000/cfg80211.c b/drivers/net/wireless/microchip/wilc1000/cfg80211.c
> > > index b545d93c6e37..45bcadeba2da 100644
> > > --- a/drivers/net/wireless/microchip/wilc1000/cfg80211.c
> > > +++ b/drivers/net/wireless/microchip/wilc1000/cfg80211.c
> > > @@ -518,7 +518,7 @@ static int wilc_wfi_cfg_allocate_wpa_igtk_entry(struct wilc_priv *priv, u8 idx)
> > > static int wilc_wfi_cfg_copy_wpa_info(struct wilc_wfi_key *key_info,
> > > struct key_params *params)
> > > {
> > > - kfree(key_info->key);
> > > + kfree_sensitive(key_info->key);
> > >
> > > key_info->key = kmemdup(params->key, params->key_len, GFP_KERNEL);
> > > if (!key_info->key)
> > > @@ -656,7 +656,7 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev, int link_id,
> > > if (!pairwise && (key_index == 4 || key_index == 5)) {
> > > key_index -= 4;
> > > if (priv->wilc_igtk[key_index]) {
> > > - kfree(priv->wilc_igtk[key_index]->key);
> > > + kfree_sensitive(priv->wilc_igtk[key_index]->key);
> >
> > Normally "kfree_sensitive()" is used at the end of a function for when
> > kfree() of a local variable might not be called because the compiler
> > thinks it is smarter than us and optimizes it away.
> >
> > Putting it here, in the normal operation, really doesn't do anything,
> > right? There's always going to be odd data in the heap and normal
>
> It does memzero.
>
> https://elixir.bootlin.com/linux/latest/source/mm/slab_common.c#L1411
I know what it does, I'm saying "why is this required".
prev parent reply other threads:[~2023-07-20 13:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230719022041.663-1-machel@vivo.com>
2023-07-19 5:36 ` [PATCH net v2] net: wireless: Use kfree_sensitive instead of kfree Greg Kroah-Hartman
2023-07-20 9:06 ` Pavel Machek
2023-07-20 13:25 ` Greg Kroah-Hartman [this message]
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=2023072020-epilepsy-duchess-0a80@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=ajay.kathat@microchip.com \
--cc=claudiu.beznea@microchip.com \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=machel@vivo.com \
--cc=opensource.kernel@vivo.com \
--cc=pavel@ucw.cz \
/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