Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1025202yba; Thu, 4 Apr 2019 02:42:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqzdfws3eXskih8DrpuW+ET60UdUXAvqbYpjM73ALZ+AGgD3DNwXQxu0hGb9dnG5sFUeO2WC X-Received: by 2002:a63:ff18:: with SMTP id k24mr4777238pgi.140.1554370923788; Thu, 04 Apr 2019 02:42:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554370923; cv=none; d=google.com; s=arc-20160816; b=UtKqGCS5c3EW1iJldCn797gwIQUfIBBJ7ETDh2CS2UAQV3Jwc1BN5zvnr8S6R/dDHq 3sU1EuY8tfaIUXGkdcdMZeYb7/1D5pMbXhWs9wASs7NtWQ/NLKRPAHNk/waa3092YZST hZEzbwlT+z+J9v+7BIivaRHEma+dVhqGL8lg9QJzO1iE9+NBBNQ3JLSVE8V+wKFVp/yk iaP+G0+zyTZO9PlvQ5/mKW7EERGblaE/dzwA4hY+CqcsDhNv17zE/51tJNNo4UcXebsg CRuEHfjl8icomU7UMrEIO7IQgV/aYkni64Ab1P4hWRxTzUETaO67GdQTZfA3Khsp2LO+ 84Gg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CIcrRsjROaD4zk6XtWnOSWj20mIWLLzKkrViS2j83Ow=; b=HhG89zKlG1RFfDAFbT/dTyk9tc1klLqBlAIuX6wv7XhARNLSaXlg5MkwYazu8btQFY lGvwTTQ51dTSFkBXwo1oCBNCcZF3+gcW+iHqPUJghu5UU3cV8EpxrDr0+Q8D8TrCBUhd GFeLxZ4i2wLBGpKnTsjJCXL6ucZK1Nr6PH8ewim+niNEQ4l8PCxMRTq7vncnKG9eyA9+ fekRnl761EHiHYZhatNIT/ruhcS2diLKrXlW8WGVgm0zJ3lF/ChIGwFUqT58yOKbcYES YrTJDnqMWNADdYTRHT/Wkj8OZ4mqc5qe97IGWJmBsjjN80O1278XOWPTb668zIINJTOw L6bQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ekTQLhTF; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 82si15949915pft.35.2019.04.04.02.41.48; Thu, 04 Apr 2019 02:42:03 -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=ekTQLhTF; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731632AbfDDJCg (ORCPT + 99 others); Thu, 4 Apr 2019 05:02:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:39948 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731165AbfDDJCd (ORCPT ); Thu, 4 Apr 2019 05:02:33 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D7AB42147C; Thu, 4 Apr 2019 09:02:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554368552; bh=ME5p1rp+NlcYdq046JAhJ4S+BtKiJHBvQYDamaJQpcs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ekTQLhTFNVN706pqjpFHpd8Q5KrhtLppdA2rLnj+0IcmHgPDrIqWtMQetH8l6lTeg MX29XZqiDbqKivOeh9TlpSQD7U16trd6OPiYbS1TQHrN8FbZed1VMXCSJqBl9XVFDg BuuMHg048cAT1dJNay3U504V9r8kIPaodzCizi8o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 081/187] mwifiex: dont advertise IBSS features without FW support Date: Thu, 4 Apr 2019 10:46:58 +0200 Message-Id: <20190404084606.856776008@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190404084603.119654039@linuxfoundation.org> References: <20190404084603.119654039@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ [ 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 adc88433faa8..2d87ebbfa4da 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -4282,11 +4282,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; @@ -4346,11 +4348,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