* [PATCH v2 1/8] Bluetooth: Use kzfree instead of kfree in security manager
@ 2015-03-16 8:10 Marcel Holtmann
2015-03-16 8:38 ` Johan Hedberg
0 siblings, 1 reply; 2+ messages in thread
From: Marcel Holtmann @ 2015-03-16 8:10 UTC (permalink / raw)
To: linux-bluetooth
Within the security manager, it makes sense to use kzfree instead of
kfree for all data structures. This ensures that no key material leaks
by accident.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/smp.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index 9155840068cf..a2be6fcc3c51 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -681,9 +681,9 @@ static void smp_chan_destroy(struct l2cap_conn *conn)
complete = test_bit(SMP_FLAG_COMPLETE, &smp->flags);
mgmt_smp_complete(hcon, complete);
- kfree(smp->csrk);
- kfree(smp->slave_csrk);
- kfree(smp->link_key);
+ kzfree(smp->csrk);
+ kzfree(smp->slave_csrk);
+ kzfree(smp->link_key);
crypto_free_blkcipher(smp->tfm_aes);
crypto_free_hash(smp->tfm_cmac);
@@ -717,7 +717,7 @@ static void smp_chan_destroy(struct l2cap_conn *conn)
}
chan->data = NULL;
- kfree(smp);
+ kzfree(smp);
hci_conn_drop(hcon);
}
@@ -1097,13 +1097,13 @@ static void sc_generate_link_key(struct smp_chan *smp)
return;
if (smp_h6(smp->tfm_cmac, smp->tk, tmp1, smp->link_key)) {
- kfree(smp->link_key);
+ kzfree(smp->link_key);
smp->link_key = NULL;
return;
}
if (smp_h6(smp->tfm_cmac, smp->link_key, lebr, smp->link_key)) {
- kfree(smp->link_key);
+ kzfree(smp->link_key);
smp->link_key = NULL;
return;
}
@@ -1300,7 +1300,7 @@ static struct smp_chan *smp_chan_create(struct l2cap_conn *conn)
smp->tfm_aes = crypto_alloc_blkcipher("ecb(aes)", 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(smp->tfm_aes)) {
BT_ERR("Unable to create ECB crypto context");
- kfree(smp);
+ kzfree(smp);
return NULL;
}
@@ -1308,7 +1308,7 @@ static struct smp_chan *smp_chan_create(struct l2cap_conn *conn)
if (IS_ERR(smp->tfm_cmac)) {
BT_ERR("Unable to create CMAC crypto context");
crypto_free_blkcipher(smp->tfm_aes);
- kfree(smp);
+ kzfree(smp);
return NULL;
}
--
2.1.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2 1/8] Bluetooth: Use kzfree instead of kfree in security manager
2015-03-16 8:10 [PATCH v2 1/8] Bluetooth: Use kzfree instead of kfree in security manager Marcel Holtmann
@ 2015-03-16 8:38 ` Johan Hedberg
0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2015-03-16 8:38 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
Hi Marcel,
On Mon, Mar 16, 2015, Marcel Holtmann wrote:
> Within the security manager, it makes sense to use kzfree instead of
> kfree for all data structures. This ensures that no key material leaks
> by accident.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/smp.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
All 8 patches in this set have been applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-16 8:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-16 8:10 [PATCH v2 1/8] Bluetooth: Use kzfree instead of kfree in security manager Marcel Holtmann
2015-03-16 8:38 ` Johan Hedberg
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.