From nobody Tue Feb 10 17:51:14 2026 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA672192B72 for ; Fri, 9 Aug 2024 09:52:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723197125; cv=none; b=UyBcbiZgBokmoOMDOCNs0TGtj57ODVdCWcGTSYLoEfKkmlQHRtc24ZFLHqQVgS1Y5DVncZQBmSV0J3HmjpiXLrW+bjrIeydHrVPZRtZPpCukcQLD3kovIi5ZN0fk3dF4kNy0KMlx0lnVUz0g8a7LdutT+4CpgJPhd6RMd2WnMtQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723197125; c=relaxed/simple; bh=g7RoypxajwXMZFrzck4NL/lXCeP518asaqyIT4KhpQ4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=mQBmxL3VowulR9cNBmzgroZMyd5NNEZYZarOjt1CaxNIF4/pFTb3wXPK1zUKiFiORFhlQeBm2Q9/A5mn0NIQMoglMqEYhii2+53s5CeVg6/+DmC69Fb224NCsMrm1yms2t76xxk4Ex+MMyDAkfIqFs+qZsrdrMb9OXSjzg+4liQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1scMHu-0005n8-1j; Fri, 09 Aug 2024 11:51:58 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1scMHt-005dSz-7j; Fri, 09 Aug 2024 11:51:57 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1scMHt-003x37-0U; Fri, 09 Aug 2024 11:51:57 +0200 From: Sascha Hauer Date: Fri, 09 Aug 2024 11:51:48 +0200 Subject: [PATCH] wifi: mwifiex: keep mwifiex_cfg80211_ops constant Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240809-mwifiex-duplicate-mwifiex_cfg80211_ops-v1-1-23e0e6290ace@pengutronix.de> X-B4-Tracking: v=1; b=H4sIALPmtWYC/zWNQQqDMBQFryJ/3cBPIjbtVUoRiS/2Q6shaasg3 t0guJxZzKyUkQSZ7tVKCX/JMo0F9KUi/+rGAUr6wmTY1Oz4pj6zBMGi+l98i+++OE3rw+DYaN1 OMSt7ZUbjrIO3VGIxIchyjB7PbdsBK7gBGXgAAAA= To: Brian Norris , Francesco Dolcini , Kalle Valo , David Lin Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1723197117; l=3264; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=g7RoypxajwXMZFrzck4NL/lXCeP518asaqyIT4KhpQ4=; b=QJo3gZs3iu5FXBmRKM8pc/02iIp80T32stDNK5pCl+cSbs+QqyiobaO+6p4c6s/PtqHzIX/PD H+TkmSBZx40CnzbevJ+xLlZTCaPeRY+agFR+ev/7cABifjmIkB3dMPZ X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org With host_mlme support being added mwifiex_cfg80211_ops is no longer constant, but supplemented with the host_mlme related ops when host_mlme support is enabled. This doesn't work with multiple adapters when only few of then have host_mlme support. Duplicate mwifiex_cfg80211_ops before using it and keep the original constant. While at it mark mwifiex_cfg80211_ops const to prevent people from changing it again during runtime. Fixes: 36995892c271c ("wifi: mwifiex: add host mlme for client mode") Signed-off-by: Sascha Hauer Acked-by: Brian Norris Reviewed-by: Francesco Dolcini --- Kalle, the commit breaking it still sits in wireless-next. Feel free to squash this into the original commit if convenient for you. --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 26 ++++++++++++++-------= ---- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/= wireless/marvell/mwifiex/cfg80211.c index 722ead51e9123..e36ef075fe053 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -4570,7 +4570,7 @@ mwifiex_cfg80211_probe_client(struct wiphy *wiphy, } =20 /* station cfg80211 operations */ -static struct cfg80211_ops mwifiex_cfg80211_ops =3D { +static const struct cfg80211_ops mwifiex_cfg80211_ops =3D { .add_virtual_intf =3D mwifiex_add_virtual_intf, .del_virtual_intf =3D mwifiex_del_virtual_intf, .change_virtual_intf =3D mwifiex_cfg80211_change_virtual_intf, @@ -4705,24 +4705,28 @@ int mwifiex_register_cfg80211(struct mwifiex_adapte= r *adapter) struct mwifiex_private *priv =3D adapter->priv[MWIFIEX_BSS_TYPE_STA]; u8 *country_code; u32 thr, retry; + struct cfg80211_ops *ops; + + ops =3D devm_kmemdup(adapter->dev, &mwifiex_cfg80211_ops, + sizeof(mwifiex_cfg80211_ops), GFP_KERNEL); + if (!ops) + return -ENOMEM; =20 /* create a new wiphy for use with cfg80211 */ - wiphy =3D wiphy_new(&mwifiex_cfg80211_ops, - sizeof(struct mwifiex_adapter *)); + wiphy =3D wiphy_new(ops, sizeof(struct mwifiex_adapter *)); if (!wiphy) { mwifiex_dbg(adapter, ERROR, "%s: creating new wiphy\n", __func__); return -ENOMEM; } if (adapter->host_mlme_enabled) { - mwifiex_cfg80211_ops.auth =3D mwifiex_cfg80211_authenticate; - mwifiex_cfg80211_ops.assoc =3D mwifiex_cfg80211_associate; - mwifiex_cfg80211_ops.deauth =3D mwifiex_cfg80211_deauthenticate; - mwifiex_cfg80211_ops.disassoc =3D mwifiex_cfg80211_disassociate; - mwifiex_cfg80211_ops.disconnect =3D NULL; - mwifiex_cfg80211_ops.connect =3D NULL; - mwifiex_cfg80211_ops.probe_client =3D - mwifiex_cfg80211_probe_client; + ops->auth =3D mwifiex_cfg80211_authenticate; + ops->assoc =3D mwifiex_cfg80211_associate; + ops->deauth =3D mwifiex_cfg80211_deauthenticate; + ops->disassoc =3D mwifiex_cfg80211_disassociate; + ops->disconnect =3D NULL; + ops->connect =3D NULL; + ops->probe_client =3D mwifiex_cfg80211_probe_client; } wiphy->max_scan_ssids =3D MWIFIEX_MAX_SSID_LIST_LENGTH; wiphy->max_scan_ie_len =3D MWIFIEX_MAX_VSIE_LEN; --- base-commit: 4ab9f870a6335af27507d1f3bfb29635d956af48 change-id: 20240809-mwifiex-duplicate-mwifiex_cfg80211_ops-3700e6838ec3 Best regards, --=20 Sascha Hauer