iwlwifi: mvm: reject new beacons when in inject mode
authorSara Sharon <sara.sharon@intel.com>
Sun, 27 Jan 2019 09:24:30 +0000 (11:24 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Wed, 20 Feb 2019 18:47:56 +0000 (20:47 +0200)
Verify we do not accept new beacon templates while beacon
injection is active.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h

index 80b0b2e..05a6db2 100644 (file)
@@ -8,7 +8,7 @@
  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
- * Copyright(c) 2018        Intel Corporation
+ * Copyright(c) 2018 - 2019 Intel Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -31,7 +31,7 @@
  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
- * Copyright(c) 2018        Intel Corporation
+ * Copyright(c) 2018 - 2019 Intel Corporation
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -1238,6 +1238,8 @@ static int _iwl_dbgfs_inject_beacon_ie(struct iwl_mvm *mvm, char *bin, int len)
                goto out_err;
        }
 
+       mvm->beacon_inject_active = true;
+
        mvmvif = iwl_mvm_vif_from_mac80211(vif);
        info = IEEE80211_SKB_CB(beacon);
        rate = iwl_mvm_mac_ctxt_get_lowest_rate(info, vif);
@@ -1287,6 +1289,7 @@ static ssize_t iwl_dbgfs_inject_beacon_ie_restore_write(struct iwl_mvm *mvm,
        int ret = _iwl_dbgfs_inject_beacon_ie(mvm, NULL, 0);
 
        mvm->hw->extra_beacon_tailroom = 0;
+       mvm->beacon_inject_active = false;
        return ret ?: count;
 }
 
index 9bd4376..003a206 100644 (file)
@@ -1041,6 +1041,11 @@ int iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm,
        if (!beacon)
                return -ENOMEM;
 
+#ifdef CONFIG_IWLWIFI_DEBUGFS
+       if (mvm->beacon_inject_active)
+               return -EBUSY;
+#endif
+
        ret = iwl_mvm_mac_ctxt_send_beacon(mvm, vif, beacon);
        dev_kfree_skb(beacon);
        return ret;
index 9993337..acb4cca 100644 (file)
@@ -978,6 +978,7 @@ struct iwl_mvm {
        u32 dbgfs_prph_reg_addr;
        bool disable_power_off;
        bool disable_power_off_d3;
+       bool beacon_inject_active;
 
        bool scan_iter_notif_enabled;