Skip to content

Commit

Permalink
mac802154: llsec: use kzfree
Browse files Browse the repository at this point in the history
This patch will use kzfree instead kfree for security related
information which can be offered by acccident.

Signed-off-by: Alexander Aring <[email protected]>
Signed-off-by: Marcel Holtmann <[email protected]>
  • Loading branch information
alexaring authored and holtmann committed Oct 20, 2015
1 parent a6ad2a6 commit 71cd2aa
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions net/mac802154/llsec.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void mac802154_llsec_destroy(struct mac802154_llsec *sec)

msl = container_of(sl, struct mac802154_llsec_seclevel, level);
list_del(&sl->list);
kfree(msl);
kzfree(msl);
}

list_for_each_entry_safe(dev, dn, &sec->table.devices, list) {
Expand All @@ -72,7 +72,7 @@ void mac802154_llsec_destroy(struct mac802154_llsec *sec)
mkey = container_of(key->key, struct mac802154_llsec_key, key);
list_del(&key->list);
llsec_key_put(mkey);
kfree(key);
kzfree(key);
}
}

Expand Down Expand Up @@ -161,7 +161,7 @@ llsec_key_alloc(const struct ieee802154_llsec_key *template)
if (key->tfm[i])
crypto_free_aead(key->tfm[i]);

kfree(key);
kzfree(key);
return NULL;
}

Expand All @@ -176,7 +176,7 @@ static void llsec_key_release(struct kref *ref)
crypto_free_aead(key->tfm[i]);

crypto_free_blkcipher(key->tfm0);
kfree(key);
kzfree(key);
}

static struct mac802154_llsec_key*
Expand Down Expand Up @@ -267,7 +267,7 @@ int mac802154_llsec_key_add(struct mac802154_llsec *sec,
return 0;

fail:
kfree(new);
kzfree(new);
return -ENOMEM;
}

Expand Down Expand Up @@ -347,10 +347,10 @@ static void llsec_dev_free(struct mac802154_llsec_device *dev)
devkey);

list_del(&pos->list);
kfree(devkey);
kzfree(devkey);
}

kfree(dev);
kzfree(dev);
}

int mac802154_llsec_dev_add(struct mac802154_llsec *sec,
Expand Down Expand Up @@ -681,7 +681,7 @@ llsec_do_encrypt_auth(struct sk_buff *skb, const struct mac802154_llsec *sec,

rc = crypto_aead_encrypt(req);

kfree(req);
kzfree(req);

return rc;
}
Expand Down Expand Up @@ -881,7 +881,7 @@ llsec_do_decrypt_auth(struct sk_buff *skb, const struct mac802154_llsec *sec,

rc = crypto_aead_decrypt(req);

kfree(req);
kzfree(req);
skb_trim(skb, skb->len - authlen);

return rc;
Expand Down Expand Up @@ -921,7 +921,7 @@ llsec_update_devkey_record(struct mac802154_llsec_device *dev,
if (!devkey)
list_add_rcu(&next->devkey.list, &dev->dev.keys);
else
kfree(next);
kzfree(next);

spin_unlock_bh(&dev->lock);
}
Expand Down

0 comments on commit 71cd2aa

Please sign in to comment.