Skip to content

Commit 49f27f2

Browse files
Vitaliy Shevtsovjmberg-intel
authored andcommitted
wifi: nl80211: reject cooked mode if it is set along with other flags
It is possible to set both MONITOR_FLAG_COOK_FRAMES and MONITOR_FLAG_ACTIVE flags simultaneously on the same monitor interface from the userspace. This causes a sub-interface to be created with no IEEE80211_SDATA_IN_DRIVER bit set because the monitor interface is in the cooked state and it takes precedence over all other states. When the interface is then being deleted the kernel calls WARN_ONCE() from check_sdata_in_driver() because of missing that bit. Fix this by rejecting MONITOR_FLAG_COOK_FRAMES if it is set along with other flags. Found by Linux Verification Center (linuxtesting.org) with Syzkaller. Fixes: 66f7ac5 ("nl80211: Add monitor interface configuration flags") Cc: stable@vger.kernel.org Reported-by: syzbot+2e5c1e55b9e5c28a3da7@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=2e5c1e55b9e5c28a3da7 Signed-off-by: Vitaliy Shevtsov <v.shevtsov@mt-integration.ru> Link: https://patch.msgid.link/20250131152657.5606-1-v.shevtsov@mt-integration.ru Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent b76adb9 commit 49f27f2

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

net/wireless/nl80211.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4220,6 +4220,11 @@ static int parse_monitor_flags(struct nlattr *nla, u32 *mntrflags)
42204220
if (flags[flag])
42214221
*mntrflags |= (1<<flag);
42224222

4223+
/* cooked monitor mode is incompatible with other modes */
4224+
if (*mntrflags & MONITOR_FLAG_COOK_FRAMES &&
4225+
*mntrflags != MONITOR_FLAG_COOK_FRAMES)
4226+
return -EOPNOTSUPP;
4227+
42234228
*mntrflags |= MONITOR_FLAG_CHANGED;
42244229

42254230
return 0;

0 commit comments

Comments
 (0)