Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5649511img; Wed, 27 Mar 2019 12:25:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqxC0YarOxIaPo0RBLKLbXcWCW91kfIbwKNzQtZUzCyICPYaOtG3kMaOJ4UIEy+0m2RS6c3t X-Received: by 2002:a63:f80f:: with SMTP id n15mr36077620pgh.283.1553714749807; Wed, 27 Mar 2019 12:25:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553714749; cv=none; d=google.com; s=arc-20160816; b=PObeHry104GUO7vsAevjkJHH/8fp/3LY7aD85gvNfyrLde/M9f/NjIa3dBYPvMm1T/ bO8t1zpeI/0S4ccr2v9ERU/2HkuB4/TjpV4mTgaqZstMEoPlNIH8V0I6V+J0x/LBF7Ky vVSV+/I7S+4lvW4qaxgke+t0ajp2IF6zws6O7lViJiCfQfvCyUk09VvSerxk45TjFTC7 0h3Ex8580CsecfW9eoExT4H1kKVRXJUt9YPh5KHvteE5+GyPzWpoPyKO7AUX7bVifM/o MyCp2G6TzxNuFjtlra5rj2w2edeVo2pZOoky9nuEkI8RluSb41GI3VYtPz0xoEtpQSqO wfJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=K4+ztooJBQ25pjZxWvDwsViCarNyR0nSiXdZwKHDhPE=; b=RWv3wbjmeTLpEvkXCwLGsal4XRmJ3H+NqW01kX0eK3+aH6u8LtYjUhiIE8kqcs7A01 KWVMJqECHETE3LNQg+HtnsP0g4oabU/yBBm0JYi2MoN/lURYyj4hUCkjm6w+5yAM9Si4 CYoC3ubP8zJWbUKkqfmPUj4GeNr3Sy2AY043HRap+/LPBA3mWaegh5UDkzkvIwnLVVxF ujY+T3EnTD66oO4gTHn8oSLdBR4uviDjYQskfEvWyAUuUrC/asg90fK2oNd4qFcoCJ7t 4AX6hiMl0NaJsb5AET9EFLXU6vE9QFECijp2vBMrm3XE5k6Usk09NVCOYFHAXcKi6PZ9 /ujA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1h4BKuPN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g1si19234133pgd.495.2019.03.27.12.25.34; Wed, 27 Mar 2019 12:25:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1h4BKuPN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730596AbfC0SF3 (ORCPT + 99 others); Wed, 27 Mar 2019 14:05:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:46592 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387677AbfC0SFZ (ORCPT ); Wed, 27 Mar 2019 14:05:25 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 80B55217F9; Wed, 27 Mar 2019 18:05:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553709925; bh=TGEWCY/rvzWzZ9YrYMXVfiNXzxSPUBhPdrFq5cU5Us4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1h4BKuPNweDNADW1ffCRCDt1qF1naEkH1s/hBoTyeZoRcsWJSIn2So/gZkuJZIGMK vqaHIqAP+4d4YOBQiejCFhDqcaxV35dSWykbczgLZBYqUVZDdQUBT4rJFCzxkJ5OEU Onap/9qsHSobyhFQB+Vko56Qe6Mk0I22ZeejXGoc= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Brian Norris , Kalle Valo , Sasha Levin , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.0 116/262] mwifiex: don't advertise IBSS features without FW support Date: Wed, 27 Mar 2019 13:59:31 -0400 Message-Id: <20190327180158.10245-116-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327180158.10245-1-sashal@kernel.org> References: <20190327180158.10245-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Brian Norris [ 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 Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index 1467af22e394..883752f640b4 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -4310,11 +4310,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; @@ -4374,11 +4376,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 | -- 2.19.1