]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
mwifiex: don't advertise IBSS features without FW support
authorBrian Norris <briannorris@chromium.org>
Fri, 15 Feb 2019 00:31:29 +0000 (16:31 -0800)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
BugLink: https://bugs.launchpad.net/bugs/1838116
[ Upstream commit 6f21ab30469d670de620f758330aca9f3433f693 ]

As it is, doing something like

  # iw phy phy0 interface add foobar type ibss

on a firmware that doesn't have ad-hoc support just yields failures of
HostCmd_CMD_SET_BSS_MODE, which happened to return a '-1' error code
(-EPERM? not really right...) and sometimes may even crash the firmware
along the way.

Let's parse the firmware capability flag while registering the wiphy, so
we don't allow attempting IBSS at all, and we get a proper -EOPNOTSUPP
from nl80211 instead.

Fixes: e267e71e68ae ("mwifiex: Disable adhoc feature based on firmware capability")
Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/net/wireless/marvell/mwifiex/cfg80211.c

index f32401197f7c0f718376a9ac8f5a92f3451c4fa5..ebbfdfde66f7d7534b22988cd6a8445432910c12 100644 (file)
@@ -4254,11 +4254,13 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
        wiphy->mgmt_stypes = mwifiex_mgmt_stypes;
        wiphy->max_remain_on_channel_duration = 5000;
        wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
-                                BIT(NL80211_IFTYPE_ADHOC) |
                                 BIT(NL80211_IFTYPE_P2P_CLIENT) |
                                 BIT(NL80211_IFTYPE_P2P_GO) |
                                 BIT(NL80211_IFTYPE_AP);
 
+       if (ISSUPP_ADHOC_ENABLED(adapter->fw_cap_info))
+               wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC);
+
        wiphy->bands[NL80211_BAND_2GHZ] = &mwifiex_band_2ghz;
        if (adapter->config_bands & BAND_A)
                wiphy->bands[NL80211_BAND_5GHZ] = &mwifiex_band_5ghz;
@@ -4315,11 +4317,13 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
        wiphy->available_antennas_tx = BIT(adapter->number_of_antenna) - 1;
        wiphy->available_antennas_rx = BIT(adapter->number_of_antenna) - 1;
 
-       wiphy->features |= NL80211_FEATURE_HT_IBSS |
-                          NL80211_FEATURE_INACTIVITY_TIMER |
+       wiphy->features |= NL80211_FEATURE_INACTIVITY_TIMER |
                           NL80211_FEATURE_LOW_PRIORITY_SCAN |
                           NL80211_FEATURE_NEED_OBSS_SCAN;
 
+       if (ISSUPP_ADHOC_ENABLED(adapter->fw_cap_info))
+               wiphy->features |= NL80211_FEATURE_HT_IBSS;
+
        if (ISSUPP_RANDOM_MAC(adapter->fw_cap_info))
                wiphy->features |= NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR |
                                   NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR |