diff mbox series

iwlwifi: mvm: fix a memory leak in iwl_mvm_mac_ctxt_beacon_changed

Message ID 20201119124628.2926763-1-zhangqilong3@huawei.com
State New
Headers show
Series iwlwifi: mvm: fix a memory leak in iwl_mvm_mac_ctxt_beacon_changed | expand

Commit Message

Zhang Qilong Nov. 19, 2020, 12:46 p.m. UTC
In the error path of iwl_mvm_mac_ctxt_beacon_changed,
the beacon it not be freed, and use dev_kfree_skb to
free it.

Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Coelho, Luciano March 23, 2021, 9:04 a.m. UTC | #1
On Thu, 2020-11-19 at 20:46 +0800, Zhang Qilong wrote:
> In the error path of iwl_mvm_mac_ctxt_beacon_changed,

> the beacon it not be freed, and use dev_kfree_skb to

> free it.

> 

> Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>

> ---

>  drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 4 +++-

>  1 file changed, 3 insertions(+), 1 deletion(-)

> 

> diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c

> index 8698ca4d30de..e9a804ffd984 100644

> --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c

> +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c

> @@ -1044,8 +1044,10 @@ int iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm,

>  		return -ENOMEM;

>  

> 

>  #ifdef CONFIG_IWLWIFI_DEBUGFS

> -	if (mvm->beacon_inject_active)

> +	if (mvm->beacon_inject_active) {

> +		dev_kfree_skb(beacon);

>  		return -EBUSY;

> +	}

>  #endif

>  

> 

>  	ret = iwl_mvm_mac_ctxt_send_beacon(mvm, vif, beacon);


Thanks! I applied this now to our internal tree and it will reach the
mainline following our normal process.

--
Cheers.
Luca.
diff mbox series

Patch

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
index 8698ca4d30de..e9a804ffd984 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
@@ -1044,8 +1044,10 @@  int iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm,
 		return -ENOMEM;
 
 #ifdef CONFIG_IWLWIFI_DEBUGFS
-	if (mvm->beacon_inject_active)
+	if (mvm->beacon_inject_active) {
+		dev_kfree_skb(beacon);
 		return -EBUSY;
+	}
 #endif
 
 	ret = iwl_mvm_mac_ctxt_send_beacon(mvm, vif, beacon);