mac80211: choose first enabled channel for monitor
authorKarthikeyan Kathirvel <kathirve@codeaurora.org>
Thu, 11 Mar 2021 05:29:07 +0000 (10:59 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 10 Apr 2021 11:04:44 +0000 (13:04 +0200)
commit227e9c17a1b65dc95cc33793ec68113a1dfd1ebc
tree916160df91912e5ae630e97ad32835280b128c20
parenta2fad8e40d912c5916279bf93758c907a4bfb602
mac80211: choose first enabled channel for monitor

[ Upstream commit 041c881a0ba8a75f71118bd9766b78f04beed469 ]

Even if the first channel from sband channel list is invalid
or disabled mac80211 ends up choosing it as the default channel
for monitor interfaces, making them not usable.

Fix this by assigning the first available valid or enabled
channel instead.

Signed-off-by: Karthikeyan Kathirvel <kathirve@codeaurora.org>
Link: https://lore.kernel.org/r/1615440547-7661-1-git-send-email-kathirve@codeaurora.org
[reword commit message, comment, code cleanups]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/mac80211/main.c