Skip to content

Commit f435287

Browse files
januszdziedzicgregkh
authored andcommitted
cfg80211: correct bridge/4addr mode check
commit 689a0a9 upstream. Without the patch we fail: $ sudo brctl addbr br0 $ sudo brctl addif br0 wlp1s0 $ sudo iw wlp1s0 set 4addr on command failed: Device or resource busy (-16) Last command failed but iface was already in 4addr mode. Fixes: ad4bb6f ("cfg80211: disallow bridging managed/adhoc interfaces") Signed-off-by: Janusz Dziedzic <[email protected]> Link: https://lore.kernel.org/r/[email protected] [add fixes tag, fix indentation, edit commit log] Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent da279da commit f435287

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

net/wireless/util.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,14 +1028,14 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
10281028
!(rdev->wiphy.interface_modes & (1 << ntype)))
10291029
return -EOPNOTSUPP;
10301030

1031-
/* if it's part of a bridge, reject changing type to station/ibss */
1032-
if (netif_is_bridge_port(dev) &&
1033-
(ntype == NL80211_IFTYPE_ADHOC ||
1034-
ntype == NL80211_IFTYPE_STATION ||
1035-
ntype == NL80211_IFTYPE_P2P_CLIENT))
1036-
return -EBUSY;
1037-
10381031
if (ntype != otype) {
1032+
/* if it's part of a bridge, reject changing type to station/ibss */
1033+
if (netif_is_bridge_port(dev) &&
1034+
(ntype == NL80211_IFTYPE_ADHOC ||
1035+
ntype == NL80211_IFTYPE_STATION ||
1036+
ntype == NL80211_IFTYPE_P2P_CLIENT))
1037+
return -EBUSY;
1038+
10391039
dev->ieee80211_ptr->use_4addr = false;
10401040
dev->ieee80211_ptr->mesh_id_up_len = 0;
10411041
wdev_lock(dev->ieee80211_ptr);

0 commit comments

Comments
 (0)