Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp973161pxb; Tue, 14 Sep 2021 12:59:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhJlkTSmlcfXTJoiX+7fs8vHG+iVCUOHQGvSS8apTI+MDDJ4Hb6xspaTPdoR4zHO6pMLgV X-Received: by 2002:a6b:e905:: with SMTP id u5mr14636564iof.116.1631649595240; Tue, 14 Sep 2021 12:59:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631649595; cv=none; d=google.com; s=arc-20160816; b=eFtcAIj+er4vj2cVjFjLparL7FYIjoRHLbriUDzpRwVzbvO2G3iWtXnfGXVk+zsPYE L6C6YklvWFm77lZXNTeBX9/tocuS4Rwbymjr90P48zxHzXNLbtOTAlBLwYCeYqQMcoTP weKprkfv6xnk7KooFD79Fd+QGFllTcIlfjOVvtN57rmtvalMRLCc5ikuiLCze3y7IXvk IgtBg8wf/IqimFSDZkuHZskA5l1aDg4TAtI6g5hzFNyfOvJN6cSEh+nPcdrhrefcjtos MZ3zR/uMVbBe2s9s2N9rnMQqpEEbWHxwS+Af/9M2Gtro+3sHlrcAArS7GrUh78K8CuHZ Qy4A== 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=DcuTg7Q34/5Ckik6gOT/pbWIUzlDc9rBn96v72vsnvQ=; b=V+0CElVs2x+Z5kPe+U4ud+CstdLKRxEq8troEUjJUnAE0KE2tmdqccE4vN6O21Xwl7 BYI/Z7aUPF1f+RWs6+nTHOdthBO3WEVkg/Lrsp7WJSbPpuuETgcXFO9EeMxO6UxkmBUD 3CpCHJModoLZQHV1EkA/bGC/twFZWVyxtIwlKH7X6LhVX2u51dxGXjeHLY1he2oDjT4f WS6qWwT/A4s+DhMKU3VK2w2UhMBgHDfvNv4hKF9q0ltxGxy96HJDbsvx3YGp6u4Q+hx4 NZWtClnXMl8XaTUhxca4MaldnpwgQAyLERJMtAnW18h/vXPCUHiRoWjsMjddEvjEAvNl G3Tg== 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 f5si11972070ils.120.2021.09.14.12.59.37; Tue, 14 Sep 2021 12:59:55 -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 S233243AbhINUAo (ORCPT + 99 others); Tue, 14 Sep 2021 16:00:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233263AbhINUAo (ORCPT ); Tue, 14 Sep 2021 16:00:44 -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 55BCEC061574; Tue, 14 Sep 2021 12:59:26 -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 4H8DhD0b9RzQkBj; Tue, 14 Sep 2021 21:59:24 +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 1/9] mwifiex: Small cleanup for handling virtual interface type changes Date: Tue, 14 Sep 2021 21:59:01 +0200 Message-Id: <20210914195909.36035-2-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: 356F11898 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Handle the obvious invalid virtual interface type changes with a general check instead of looking at the individual change. For type changes from P2P_CLIENT to P2P_GO and the other way round, this changes the behavior slightly: We now still do nothing, but return -EOPNOTSUPP instead of 0. Now that behavior was incorrect before and still is, because type changes between these two types are actually possible and supported, which we'll fix in a following commit. Signed-off-by: Jonas Dreßler --- .../net/wireless/marvell/mwifiex/cfg80211.c | 39 +++++++------------ 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index 0961f4a5e415..e8deba119ff1 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -1141,6 +1141,20 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy, return -EBUSY; } + if (type == NL80211_IFTYPE_UNSPECIFIED) { + mwifiex_dbg(priv->adapter, INFO, + "%s: no new type specified, keeping old type %d\n", + dev->name, curr_iftype); + return 0; + } + + if (curr_iftype == type) { + mwifiex_dbg(priv->adapter, INFO, + "%s: interface already is of type %d\n", + dev->name, curr_iftype); + return 0; + } + switch (curr_iftype) { case NL80211_IFTYPE_ADHOC: switch (type) { @@ -1160,12 +1174,6 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy, case NL80211_IFTYPE_AP: return mwifiex_change_vif_to_ap(dev, curr_iftype, type, params); - case NL80211_IFTYPE_UNSPECIFIED: - mwifiex_dbg(priv->adapter, INFO, - "%s: kept type as IBSS\n", dev->name); - fallthrough; - case NL80211_IFTYPE_ADHOC: /* This shouldn't happen */ - return 0; default: mwifiex_dbg(priv->adapter, ERROR, "%s: changing to %d not supported\n", @@ -1191,12 +1199,6 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy, case NL80211_IFTYPE_AP: return mwifiex_change_vif_to_ap(dev, curr_iftype, type, params); - case NL80211_IFTYPE_UNSPECIFIED: - mwifiex_dbg(priv->adapter, INFO, - "%s: kept type as STA\n", dev->name); - fallthrough; - case NL80211_IFTYPE_STATION: /* This shouldn't happen */ - return 0; default: mwifiex_dbg(priv->adapter, ERROR, "%s: changing to %d not supported\n", @@ -1214,12 +1216,6 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy, case NL80211_IFTYPE_P2P_GO: return mwifiex_change_vif_to_p2p(dev, curr_iftype, type, params); - case NL80211_IFTYPE_UNSPECIFIED: - mwifiex_dbg(priv->adapter, INFO, - "%s: kept type as AP\n", dev->name); - fallthrough; - case NL80211_IFTYPE_AP: /* This shouldn't happen */ - return 0; default: mwifiex_dbg(priv->adapter, ERROR, "%s: changing to %d not supported\n", @@ -1254,13 +1250,6 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy, return -EFAULT; return mwifiex_change_vif_to_ap(dev, curr_iftype, type, params); - case NL80211_IFTYPE_UNSPECIFIED: - mwifiex_dbg(priv->adapter, INFO, - "%s: kept type as P2P\n", dev->name); - fallthrough; - case NL80211_IFTYPE_P2P_CLIENT: - case NL80211_IFTYPE_P2P_GO: - return 0; default: mwifiex_dbg(priv->adapter, ERROR, "%s: changing to %d not supported\n", -- 2.31.1