diff mbox

iwlwifi: Fix memory leak in iwl_req_fw_callback()

Message ID 1427137677-2879-1-git-send-email-Larry.Finger@lwfinger.net (mailing list archive)
State Accepted
Delegated to: Johannes Berg
Headers show

Commit Message

Larry Finger March 23, 2015, 7:07 p.m. UTC
In this routine, kzalloc allocates a memory block. This allocation is
freed in the error paths, but not in the normal exit, thus the allocation
is leaked.

The kmemleak facility was used to find the leak.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Johannes Berg <johannes.berg@intel.com>
Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Cc: Intel Linux Wireless <ilw@linux.intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-drv.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Emmanuel Grumbach March 24, 2015, 9:43 a.m. UTC | #1
On Mon, 2015-03-23 at 14:07 -0500, Larry Finger wrote:
> In this routine, kzalloc allocates a memory block. This allocation is

> freed in the error paths, but not in the normal exit, thus the allocation

> is leaked.

> 

> The kmemleak facility was used to find the leak.

> 


Picked up - thanks.

> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>

> Cc: Johannes Berg <johannes.berg@intel.com>

> Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>

> Cc: Intel Linux Wireless <ilw@linux.intel.com>

> ---

>  drivers/net/wireless/iwlwifi/iwl-drv.c | 1 +

>  1 file changed, 1 insertion(+)

> 

> diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.c b/drivers/net/wireless/iwlwifi/iwl-drv.c

> index 66ca000..aefdd9b 100644

> --- a/drivers/net/wireless/iwlwifi/iwl-drv.c

> +++ b/drivers/net/wireless/iwlwifi/iwl-drv.c

> @@ -1319,6 +1319,7 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context)

>  				op->name, err);

>  #endif

>  	}

> +	kfree(pieces);

>  	return;

>  

>   try_again:
diff mbox

Patch

diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.c b/drivers/net/wireless/iwlwifi/iwl-drv.c
index 66ca000..aefdd9b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/iwlwifi/iwl-drv.c
@@ -1319,6 +1319,7 @@  static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context)
 				op->name, err);
 #endif
 	}
+	kfree(pieces);
 	return;
 
  try_again: