Commit fb14996c2a555322ae2610d783e614430b259592

Authored by Luciano Coelho
Committed by Greg Kroah-Hartman
1 parent 4e709ff658

iwlwifi: mvm: check TLV flag before trying to use hotspot firmware commands

commit 5ac6c72e594471acfa5b00210c51d533a73413ad upstream.

Older firmwares do not provide support for the HOT_SPOT_CMD command.
Check for the appropriate TLV flag that declares hotspot support in
the firmware to prevent a firmware assertion failure that can be
triggered from the userspace,

Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 2 changed files with 12 additions and 4 deletions Side-by-side Diff

drivers/net/wireless/iwlwifi/iwl-fw.h
... ... @@ -138,9 +138,11 @@
138 138 /**
139 139 * enum iwl_ucode_tlv_capa - ucode capabilities
140 140 * @IWL_UCODE_TLV_CAPA_D0I3_SUPPORT: supports D0i3
  141 + * @IWL_UCODE_TLV_CAPA_HOTSPOT_SUPPORT: supports Hot Spot Command
141 142 */
142 143 enum iwl_ucode_tlv_capa {
143   - IWL_UCODE_TLV_CAPA_D0I3_SUPPORT = BIT(0),
  144 + IWL_UCODE_TLV_CAPA_D0I3_SUPPORT = BIT(0),
  145 + IWL_UCODE_TLV_CAPA_HOTSPOT_SUPPORT = BIT(18),
144 146 };
145 147  
146 148 /* The default calibrate table size if not specified by firmware file */
drivers/net/wireless/iwlwifi/mvm/mac80211.c
... ... @@ -2476,9 +2476,15 @@
2476 2476  
2477 2477 switch (vif->type) {
2478 2478 case NL80211_IFTYPE_STATION:
2479   - /* Use aux roc framework (HS20) */
2480   - ret = iwl_mvm_send_aux_roc_cmd(mvm, channel,
2481   - vif, duration);
  2479 + if (mvm->fw->ucode_capa.capa[0] &
  2480 + IWL_UCODE_TLV_CAPA_HOTSPOT_SUPPORT) {
  2481 + /* Use aux roc framework (HS20) */
  2482 + ret = iwl_mvm_send_aux_roc_cmd(mvm, channel,
  2483 + vif, duration);
  2484 + goto out_unlock;
  2485 + }
  2486 + IWL_ERR(mvm, "hotspot not supported\n");
  2487 + ret = -EINVAL;
2482 2488 goto out_unlock;
2483 2489 case NL80211_IFTYPE_P2P_DEVICE:
2484 2490 /* handle below */