Virtual monitor interfaces should only be created when all of the following conditions are fulfilled: - All remaining enabled interfaces are monitor interface(s), - %IEEE80211_HW_NO_VIRTUAL_MONITOR isn't set by the driver and - %MONITOR_FLAG_ACTIVE and %MONITOR_FLAG_COOK_FRAMES isn't set on any of the enabled (monitor) interfaces. ieee80211_add_virtual_monitor() will then setup the virtual monitor interface for local->monitor_sdata and - when %IEEE80211_HW_WANT_MONITOR_VIF is set - inform the driver about the virtual monitor interface. But assuming %IEEE80211_HW_NO_VIRTUAL_MONITOR is not set, the current code still creates a virtual monitor interface when: 1) We have one non-monitor and one monitor interface with %MONITOR_FLAG_ACTIVE enabled and then delete the non-monitor interface. 2) We only have monitor interfaces enabled on resume while at least one has %MONITOR_FLAG_ACTIVE set. Fix the logic to follow the above stated rules and fixed/updated related checks not following the logic. Signed-off-by: Alexander Wetzel <Alexander@xxxxxxxxxxxxxx> --- I have problems understanding the current logic of how monitor interfaces are handled. For me it looks like we use local->monitors sometimes to count all monitor interfaces - except the ones using %MONITOR_FLAG_COOK_FRAMES - and at other times to count interfaces linked to the virtual monitor interface. This patch tries to fix the logic according to my understanding. Noteworthy here is the wording in 0d9c2beed116 ("wifi: mac80211: fix monitor channel with chanctx emulation"): ... Fix this by always allocating the virtual monitor sdata, and simply not telling the driver about it unless it wanted to. This way, we have an interface/sdata to bind the chanctx to, and the emulation can work correctly. But the commit with this statement is not changing the condition to call ieee80211_add_virtual_monitor(), contradicting these sentences.