Re: [PATCH-v4 6/9] Bluetooth: Cleanup blkcipher on SMP termination

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Brian,

* Brian Gix <bgix@xxxxxxxxxxxxxx> [2011-11-16 13:53:17 -0800]:

> The blkcipher must be freed to avoid memory leak.
> 
> Signed-off-by: Brian Gix <bgix@xxxxxxxxxxxxxx>
> ---
>  net/bluetooth/smp.c |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
> index 94e94ca..3b3726a 100644
> --- a/net/bluetooth/smp.c
> +++ b/net/bluetooth/smp.c
> @@ -379,7 +379,13 @@ 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;
> +
> +	if (smp && !IS_ERR(smp->tfm))
> +		crypto_free_blkcipher(smp->tfm);

smp->tfm doesn't say what you want, if its allocation failed its value is
still 0. And I don't think we need to check for smp == NULL. It can't be null
at this point.

	Gustavo
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux