@@ -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);
priv->wilc_igtk[key_index]->key = NULL;
kfree(priv->wilc_igtk[key_index]->seq);
priv->wilc_igtk[key_index]->seq = NULL;
@@ -665,7 +665,7 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev, int link_id,
}
} else {
if (priv->wilc_gtk[key_index]) {
- kfree(priv->wilc_gtk[key_index]->key);
+ kfree_sensitive(priv->wilc_gtk[key_index]->key);
priv->wilc_gtk[key_index]->key = NULL;
kfree(priv->wilc_gtk[key_index]->seq);
priv->wilc_gtk[key_index]->seq = NULL;
@@ -674,7 +674,7 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev, int link_id,
priv->wilc_gtk[key_index] = NULL;
}
if (priv->wilc_ptk[key_index]) {
- kfree(priv->wilc_ptk[key_index]->key);
+ kfree_sensitive(priv->wilc_ptk[key_index]->key);
priv->wilc_ptk[key_index]->key = NULL;
kfree(priv->wilc_ptk[key_index]->seq);
priv->wilc_ptk[key_index]->seq = NULL;
key might contain private part of the key, so better use kfree_sensitive to free it. Fixes: 7cec84fdfd88 ("staging: wilc1000: split add_key() to avoid line over 80 chars") Signed-off-by: Wang Ming <machel@vivo.com> --- drivers/net/wireless/microchip/wilc1000/cfg80211.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)