From c8eb969071032defb1dc493ae28cf2e2a31193a5 Mon Sep 17 00:00:00 2001 From: Brian Gix Date: Wed, 23 Nov 2011 08:28:35 -0800 Subject: Bluetooth: Cleanup blkcipher on SMP termination The blkcipher must be freed to avoid memory leak. Signed-off-by: Brian Gix Signed-off-by: Gustavo F. Padovan --- net/bluetooth/smp.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'net/bluetooth/smp.c') diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 94e94ca35384..b9af4885ae53 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c @@ -379,7 +379,15 @@ static struct smp_chan *smp_chan_create(struct l2cap_conn *conn) void smp_chan_destroy(struct l2cap_conn *conn) { - kfree(conn->smp_chan); + struct smp_chan *smp = conn->smp_chan; + + clear_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->pend); + + if (smp->tfm) + crypto_free_blkcipher(smp->tfm); + + kfree(smp); + conn->smp_chan = NULL; hci_conn_put(conn->hcon); } -- cgit v1.2.3