wifi: nl80211: reject iftype change with mesh ID change
authorJohannes Berg <johannes.berg@intel.com>
Wed, 14 Feb 2024 19:08:35 +0000 (20:08 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 15 Feb 2024 10:00:37 +0000 (11:00 +0100)
commitf78c1375339a291cba492a70eaf12ec501d28a8e
tree3bc1c9e6c8fd5298030ecfd9ba394c530da01968
parentb7198383ef2debe748118996f627452281cf27d7
wifi: nl80211: reject iftype change with mesh ID change

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>
net/wireless/nl80211.c