summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2024-02-14 20:08:35 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-03-06 14:48:40 +0000
commit177d574be4b58f832354ab1ef5a297aa0c9aa2df (patch)
tree962da066932724f1d01a0326a047a90786d33e4d
parentad8ff8cff38d12f8da1f13b55dc634fcfb55b773 (diff)
downloadlinux-stable-177d574be4b58f832354ab1ef5a297aa0c9aa2df.tar.gz
linux-stable-177d574be4b58f832354ab1ef5a297aa0c9aa2df.tar.bz2
linux-stable-177d574be4b58f832354ab1ef5a297aa0c9aa2df.zip
wifi: nl80211: reject iftype change with mesh ID change
commit f78c1375339a291cba492a70eaf12ec501d28a8e upstream. It's currently possible to change the mesh ID when the interface isn't yet in mesh mode, at the same time as changing it into mesh mode. This leads to an overwrite of data in the wdev->u union for the interface type it currently has, causing cfg80211_change_iface() to do wrong things when switching. We could probably allow setting an interface to mesh while setting the mesh ID at the same time by doing a different order of operations here, but realistically there's no userspace that's going to do this, so just disallow changes in iftype when setting mesh ID. Cc: stable@vger.kernel.org Fixes: 29cbe68c516a ("cfg80211/mac80211: add mesh join/leave commands") Reported-by: syzbot+dd4779978217b1973180@syzkaller.appspotmail.com Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--net/wireless/nl80211.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index c8bfacd5c8f3..9f6d8bcecfeb 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -4189,6 +4189,8 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info)
if (ntype != NL80211_IFTYPE_MESH_POINT)
return -EINVAL;
+ if (otype != NL80211_IFTYPE_MESH_POINT)
+ return -EINVAL;
if (netif_running(dev))
return -EBUSY;