Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp974497pxb; Tue, 14 Sep 2021 13:01:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzE4EJS7hzuyODTPSAL8Nhgd3U1cF3QDyCha2me3HH+hh0bcwjeL4uaWHw+QxdK5Whe++0O X-Received: by 2002:a92:c04c:: with SMTP id o12mr8984781ilf.124.1631649706757; Tue, 14 Sep 2021 13:01:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631649706; cv=none; d=google.com; s=arc-20160816; b=a+POMkQDV4VVvYHzC2ZdUK3iGZFqUXfPJ9ZLt2ejXfXVFwf3ydKTuZg9XloeHo41cZ eW2IN0pA92jWPUmL7GSidyrIA2W76j96ytpnjKV+bIIwRRbmx0D/MeurK29rpmQphz4I LtgdbpRPLClJU2Nb+yrd/9PscCrn5s7F6qljJh1ofuzd5bLtHMktWqty63PMYQkqMhsz itWhC5sFunOdZ1dgEyoZ70Em/TBuxchJyXHusmnkpjoPAONqVU8cOu3dLqh1dxgP9nQ+ qemZ7kDm/Dp4IvmJ167FFihMq3s6VaWPhjzzRXS2TetaYBUaUzTSt0TtYDBqWwSnhD4d YWCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=t2pjGDsRWItE3J6S+b8QwG/lFZeHqE09tT7yNuXxknA=; b=GWhCcTbXKKIdcRcsHWtAeDNU1aGUKuI5yLdg55ENvJVLQrXUPh1BjQ0Xsb/mYg1nK2 suNPTg8JoAsYf4PlXZsg8oVPhV+MsZgJfGZWbhVg33D65P4fpzqf2Y7v7bpQeS3Z1hwr KQ6mKet3IgRd5F1z3M3VrSoVh9bivIkB9WWXqKHDAkCoKc8LfjziCpEdDIBomI337X8F 9RlxD+2EpGQAvUpa+TXQmKY23tWqn0Ib9+dzzQd+Ngyhm7INZInGmkqkc/S7scz4o6kZ lW62kJQ5Y0y2wzH9OCXcBJ7T4bQgCLL14c8s0O8cqu5ovBLXDo+JSqA9ZtGHm2JVeGfI c2MQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t6si1298447jac.110.2021.09.14.13.01.34; Tue, 14 Sep 2021 13:01:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233963AbhINUCH (ORCPT + 99 others); Tue, 14 Sep 2021 16:02:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233476AbhINUBE (ORCPT ); Tue, 14 Sep 2021 16:01:04 -0400 Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [IPv6:2001:67c:2050::465:101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 068FEC061766; Tue, 14 Sep 2021 12:59:47 -0700 (PDT) Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4H8Dhd4yJRzQkBj; Tue, 14 Sep 2021 21:59:45 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= To: Amitkumar Karwar , Ganapathi Bhat , Sharvari Harisangam , Xinming Hu , Kalle Valo , "David S. Miller" , Jakub Kicinski Cc: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= , Tsuchiya Yuto , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Maximilian Luz , Andy Shevchenko , =?UTF-8?q?Pali=20Roh=C3=A1r?= Subject: [PATCH 8/9] mwifiex: Properly initialize private structure on interface type changes Date: Tue, 14 Sep 2021 21:59:08 +0200 Message-Id: <20210914195909.36035-9-verdre@v0yd.nl> In-Reply-To: <20210914195909.36035-1-verdre@v0yd.nl> References: <20210914195909.36035-1-verdre@v0yd.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C7EFD18B0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org When creating a new virtual interface in mwifiex_add_virtual_intf(), we update our internal driver states like bss_type, bss_priority, bss_role and bss_mode to reflect the mode the firmware will be set to. When switching virtual interface mode using mwifiex_init_new_priv_params() though, we currently only update bss_mode and bss_role. In order for the interface mode switch to actually work, we also need to update bss_type to its proper value, so do that. This fixes a crash of the firmware (because the driver tries to execute commands that are invalid in AP mode) when switching from station mode to AP mode. Signed-off-by: Jonas Dreßler --- 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 64caa5c4350d..0eb31201a82b 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -908,16 +908,20 @@ mwifiex_init_new_priv_params(struct mwifiex_private *priv, switch (type) { case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_ADHOC: - priv->bss_role = MWIFIEX_BSS_ROLE_STA; + priv->bss_role = MWIFIEX_BSS_ROLE_STA; + priv->bss_type = MWIFIEX_BSS_TYPE_STA; break; case NL80211_IFTYPE_P2P_CLIENT: - priv->bss_role = MWIFIEX_BSS_ROLE_STA; + priv->bss_role = MWIFIEX_BSS_ROLE_STA; + priv->bss_type = MWIFIEX_BSS_TYPE_P2P; break; case NL80211_IFTYPE_P2P_GO: - priv->bss_role = MWIFIEX_BSS_ROLE_UAP; + priv->bss_role = MWIFIEX_BSS_ROLE_UAP; + priv->bss_type = MWIFIEX_BSS_TYPE_P2P; break; case NL80211_IFTYPE_AP: priv->bss_role = MWIFIEX_BSS_ROLE_UAP; + priv->bss_type = MWIFIEX_BSS_TYPE_UAP; break; default: mwifiex_dbg(adapter, ERROR, -- 2.31.1