Skip to content

Commit

Permalink
Bluetooth: Cleanup blkcipher on SMP termination
Browse files Browse the repository at this point in the history
The blkcipher must be freed to avoid memory leak.

Signed-off-by: Brian Gix <bgix@codeaurora.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
  • Loading branch information
Brian Gix authored and Gustavo F. Padovan committed Dec 1, 2011
1 parent 1143d45 commit c8eb969
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion net/bluetooth/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit c8eb969

Please sign in to comment.