All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ath10k: fix memory leak on caldata on error exit path
@ 2016-08-15 13:46 ` Colin King
  0 siblings, 0 replies; 8+ messages in thread
From: Colin King @ 2016-08-15 13:46 UTC (permalink / raw)
  To: Kalle Valo, ath10k, linux-wireless, netdev; +Cc: linux-kernel

From: Colin Ian King <colin.king@canonical.com>

caldata is not being free'd on the error exit path, causing
a memory leak. kfree it to fix the leak.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/wireless/ath/ath10k/pci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 9a22c47..886337c 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2725,6 +2725,7 @@ static int ath10k_pci_hif_fetch_cal_eeprom(struct ath10k *ar, void **data,
 	return 0;
 
 err_free:
+	kfree(caldata);
 	kfree(data);
 
 	return -EINVAL;
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] ath10k: fix memory leak on caldata on error exit path
@ 2016-08-15 13:46 ` Colin King
  0 siblings, 0 replies; 8+ messages in thread
From: Colin King @ 2016-08-15 13:46 UTC (permalink / raw)
  To: Kalle Valo, ath10k, linux-wireless, netdev; +Cc: linux-kernel

From: Colin Ian King <colin.king@canonical.com>

caldata is not being free'd on the error exit path, causing
a memory leak. kfree it to fix the leak.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/wireless/ath/ath10k/pci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 9a22c47..886337c 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2725,6 +2725,7 @@ static int ath10k_pci_hif_fetch_cal_eeprom(struct ath10k *ar, void **data,
 	return 0;
 
 err_free:
+	kfree(caldata);
 	kfree(data);
 
 	return -EINVAL;
-- 
2.8.1


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] ath10k: fix memory leak on caldata on error exit path
  2016-08-15 13:46 ` Colin King
  (?)
  (?)
@ 2016-09-02 15:45   ` Valo, Kalle
  -1 siblings, 0 replies; 8+ messages in thread
From: Valo, Kalle @ 2016-09-02 15:45 UTC (permalink / raw)
  To: Colin King; +Cc: ath10k, linux-wireless, netdev, linux-kernel

Colin King <colin.king@canonical.com> writes:

> From: Colin Ian King <colin.king@canonical.com>
>
> caldata is not being free'd on the error exit path, causing
> a memory leak. kfree it to fix the leak.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/net/wireless/ath/ath10k/pci.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless=
/ath/ath10k/pci.c
> index 9a22c47..886337c 100644
> --- a/drivers/net/wireless/ath/ath10k/pci.c
> +++ b/drivers/net/wireless/ath/ath10k/pci.c
> @@ -2725,6 +2725,7 @@ static int ath10k_pci_hif_fetch_cal_eeprom(struct a=
th10k *ar, void **data,
>  	return 0;
> =20
>  err_free:
> +	kfree(caldata);
>  	kfree(data);
> =20
>  	return -EINVAL;

I don't think we should free data at all:

static int ath10k_download_cal_eeprom(struct ath10k *ar)
{
	size_t data_len;
	void *data =3D NULL;
	int ret;

	ret =3D ath10k_hif_fetch_cal_eeprom(ar, &data, &data_len);

Instead we should free only caldata, right?

--=20
Kalle Valo=

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ath10k: fix memory leak on caldata on error exit path
@ 2016-09-02 15:45   ` Valo, Kalle
  0 siblings, 0 replies; 8+ messages in thread
From: Valo, Kalle @ 2016-09-02 15:45 UTC (permalink / raw)
  To: Colin King; +Cc: ath10k, linux-wireless, netdev, linux-kernel

Colin King <colin.king@canonical.com> writes:

> From: Colin Ian King <colin.king@canonical.com>
>
> caldata is not being free'd on the error exit path, causing
> a memory leak. kfree it to fix the leak.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/net/wireless/ath/ath10k/pci.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
> index 9a22c47..886337c 100644
> --- a/drivers/net/wireless/ath/ath10k/pci.c
> +++ b/drivers/net/wireless/ath/ath10k/pci.c
> @@ -2725,6 +2725,7 @@ static int ath10k_pci_hif_fetch_cal_eeprom(struct ath10k *ar, void **data,
>  	return 0;
>  
>  err_free:
> +	kfree(caldata);
>  	kfree(data);
>  
>  	return -EINVAL;

I don't think we should free data at all:

static int ath10k_download_cal_eeprom(struct ath10k *ar)
{
	size_t data_len;
	void *data = NULL;
	int ret;

	ret = ath10k_hif_fetch_cal_eeprom(ar, &data, &data_len);

Instead we should free only caldata, right?

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ath10k: fix memory leak on caldata on error exit path
@ 2016-09-02 15:45   ` Valo, Kalle
  0 siblings, 0 replies; 8+ messages in thread
From: Valo, Kalle @ 2016-09-02 15:45 UTC (permalink / raw)
  To: Colin King
  Cc: ath10k-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

Colin King <colin.king-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org> writes:

> From: Colin Ian King <colin.king-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
>
> caldata is not being free'd on the error exit path, causing
> a memory leak. kfree it to fix the leak.
>
> Signed-off-by: Colin Ian King <colin.king-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
> ---
>  drivers/net/wireless/ath/ath10k/pci.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
> index 9a22c47..886337c 100644
> --- a/drivers/net/wireless/ath/ath10k/pci.c
> +++ b/drivers/net/wireless/ath/ath10k/pci.c
> @@ -2725,6 +2725,7 @@ static int ath10k_pci_hif_fetch_cal_eeprom(struct ath10k *ar, void **data,
>  	return 0;
>  
>  err_free:
> +	kfree(caldata);
>  	kfree(data);
>  
>  	return -EINVAL;

I don't think we should free data at all:

static int ath10k_download_cal_eeprom(struct ath10k *ar)
{
	size_t data_len;
	void *data = NULL;
	int ret;

	ret = ath10k_hif_fetch_cal_eeprom(ar, &data, &data_len);

Instead we should free only caldata, right?

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ath10k: fix memory leak on caldata on error exit path
@ 2016-09-02 15:45   ` Valo, Kalle
  0 siblings, 0 replies; 8+ messages in thread
From: Valo, Kalle @ 2016-09-02 15:45 UTC (permalink / raw)
  To: Colin King; +Cc: netdev, linux-wireless, linux-kernel, ath10k

Colin King <colin.king@canonical.com> writes:

> From: Colin Ian King <colin.king@canonical.com>
>
> caldata is not being free'd on the error exit path, causing
> a memory leak. kfree it to fix the leak.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/net/wireless/ath/ath10k/pci.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
> index 9a22c47..886337c 100644
> --- a/drivers/net/wireless/ath/ath10k/pci.c
> +++ b/drivers/net/wireless/ath/ath10k/pci.c
> @@ -2725,6 +2725,7 @@ static int ath10k_pci_hif_fetch_cal_eeprom(struct ath10k *ar, void **data,
>  	return 0;
>  
>  err_free:
> +	kfree(caldata);
>  	kfree(data);
>  
>  	return -EINVAL;

I don't think we should free data at all:

static int ath10k_download_cal_eeprom(struct ath10k *ar)
{
	size_t data_len;
	void *data = NULL;
	int ret;

	ret = ath10k_hif_fetch_cal_eeprom(ar, &data, &data_len);

Instead we should free only caldata, right?

-- 
Kalle Valo
_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ath10k: fix memory leak on caldata on error exit path
  2016-09-02 15:45   ` Valo, Kalle
@ 2016-09-03 16:33     ` Colin Ian King
  -1 siblings, 0 replies; 8+ messages in thread
From: Colin Ian King @ 2016-09-03 16:33 UTC (permalink / raw)
  To: Valo, Kalle; +Cc: ath10k, linux-wireless, netdev, linux-kernel

On 02/09/16 16:45, Valo, Kalle wrote:
> Colin King <colin.king@canonical.com> writes:
> 
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> caldata is not being free'd on the error exit path, causing
>> a memory leak. kfree it to fix the leak.
>>
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>> ---
>>  drivers/net/wireless/ath/ath10k/pci.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
>> index 9a22c47..886337c 100644
>> --- a/drivers/net/wireless/ath/ath10k/pci.c
>> +++ b/drivers/net/wireless/ath/ath10k/pci.c
>> @@ -2725,6 +2725,7 @@ static int ath10k_pci_hif_fetch_cal_eeprom(struct ath10k *ar, void **data,
>>  	return 0;
>>  
>>  err_free:
>> +	kfree(caldata);
>>  	kfree(data);
>>  
>>  	return -EINVAL;
> 
> I don't think we should free data at all:
> 
> static int ath10k_download_cal_eeprom(struct ath10k *ar)
> {
> 	size_t data_len;
> 	void *data = NULL;
> 	int ret;
> 
> 	ret = ath10k_hif_fetch_cal_eeprom(ar, &data, &data_len);
> 
> Instead we should free only caldata, right?
> 
Yep, good catch, I'll send V2 later.

Colin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] ath10k: fix memory leak on caldata on error exit path
@ 2016-09-03 16:33     ` Colin Ian King
  0 siblings, 0 replies; 8+ messages in thread
From: Colin Ian King @ 2016-09-03 16:33 UTC (permalink / raw)
  To: Valo, Kalle; +Cc: netdev, linux-wireless, linux-kernel, ath10k

On 02/09/16 16:45, Valo, Kalle wrote:
> Colin King <colin.king@canonical.com> writes:
> 
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> caldata is not being free'd on the error exit path, causing
>> a memory leak. kfree it to fix the leak.
>>
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>> ---
>>  drivers/net/wireless/ath/ath10k/pci.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
>> index 9a22c47..886337c 100644
>> --- a/drivers/net/wireless/ath/ath10k/pci.c
>> +++ b/drivers/net/wireless/ath/ath10k/pci.c
>> @@ -2725,6 +2725,7 @@ static int ath10k_pci_hif_fetch_cal_eeprom(struct ath10k *ar, void **data,
>>  	return 0;
>>  
>>  err_free:
>> +	kfree(caldata);
>>  	kfree(data);
>>  
>>  	return -EINVAL;
> 
> I don't think we should free data at all:
> 
> static int ath10k_download_cal_eeprom(struct ath10k *ar)
> {
> 	size_t data_len;
> 	void *data = NULL;
> 	int ret;
> 
> 	ret = ath10k_hif_fetch_cal_eeprom(ar, &data, &data_len);
> 
> Instead we should free only caldata, right?
> 
Yep, good catch, I'll send V2 later.

Colin

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-09-03 16:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-15 13:46 [PATCH] ath10k: fix memory leak on caldata on error exit path Colin King
2016-08-15 13:46 ` Colin King
2016-09-02 15:45 ` Valo, Kalle
2016-09-02 15:45   ` Valo, Kalle
2016-09-02 15:45   ` Valo, Kalle
2016-09-02 15:45   ` Valo, Kalle
2016-09-03 16:33   ` Colin Ian King
2016-09-03 16:33     ` Colin Ian King

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.