Skip to content

Commit fadb4cd

Browse files
jonas2515gregkh
authored andcommitted
mwifiex: Properly initialize private structure on interface type changes
[ Upstream commit c606008 ] 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 <verdre@v0yd.nl> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20210914195909.36035-9-verdre@v0yd.nl Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 7d3e663 commit fadb4cd

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

drivers/net/wireless/marvell/mwifiex/cfg80211.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -912,16 +912,20 @@ mwifiex_init_new_priv_params(struct mwifiex_private *priv,
912912
switch (type) {
913913
case NL80211_IFTYPE_STATION:
914914
case NL80211_IFTYPE_ADHOC:
915-
priv->bss_role = MWIFIEX_BSS_ROLE_STA;
915+
priv->bss_role = MWIFIEX_BSS_ROLE_STA;
916+
priv->bss_type = MWIFIEX_BSS_TYPE_STA;
916917
break;
917918
case NL80211_IFTYPE_P2P_CLIENT:
918-
priv->bss_role = MWIFIEX_BSS_ROLE_STA;
919+
priv->bss_role = MWIFIEX_BSS_ROLE_STA;
920+
priv->bss_type = MWIFIEX_BSS_TYPE_P2P;
919921
break;
920922
case NL80211_IFTYPE_P2P_GO:
921-
priv->bss_role = MWIFIEX_BSS_ROLE_UAP;
923+
priv->bss_role = MWIFIEX_BSS_ROLE_UAP;
924+
priv->bss_type = MWIFIEX_BSS_TYPE_P2P;
922925
break;
923926
case NL80211_IFTYPE_AP:
924927
priv->bss_role = MWIFIEX_BSS_ROLE_UAP;
928+
priv->bss_type = MWIFIEX_BSS_TYPE_UAP;
925929
break;
926930
default:
927931
mwifiex_dbg(adapter, ERROR,

0 commit comments

Comments
 (0)