iwlwifi: mvm: fix a memory leak in iwl_mvm_mac_ctxt_beacon_changed
authorZhang Qilong <zhangqilong3@huawei.com>
Mon, 2 Aug 2021 14:28:24 +0000 (17:28 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Thu, 26 Aug 2021 20:33:23 +0000 (23:33 +0300)
If beacon_inject_active is true, we will return without freeing
beacon.  Fid that by freeing it before returning.

Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
[reworded the commit message]
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802172232.d16206ca60fc.I9984a9b442c84814c307cee3213044e24d26f38a@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c

index 76a658cb5493e55aa7560d7c810595e4e1a8695a..2fbc1a3bbdcaf2f6b0a054ee9b7f2981e6a81242 100644 (file)
@@ -1008,8 +1008,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);