Patch "mac80211: choose first enabled channel for monitor" has been added to the 4.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    mac80211: choose first enabled channel for monitor

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mac80211-choose-first-enabled-channel-for-monitor.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 7c067ce43783e2a17a709daa9d0c87f1652ccf63
Author: Karthikeyan Kathirvel <kathirve@xxxxxxxxxxxxxx>
Date:   Thu Mar 11 10:59:07 2021 +0530

    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@xxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/1615440547-7661-1-git-send-email-kathirve@xxxxxxxxxxxxxx
    [reword commit message, comment, code cleanups]
    Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 15d23aeea634..2357b17254e7 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -889,8 +889,19 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
 			continue;
 
 		if (!dflt_chandef.chan) {
+			/*
+			 * Assign the first enabled channel to dflt_chandef
+			 * from the list of channels
+			 */
+			for (i = 0; i < sband->n_channels; i++)
+				if (!(sband->channels[i].flags &
+						IEEE80211_CHAN_DISABLED))
+					break;
+			/* if none found then use the first anyway */
+			if (i == sband->n_channels)
+				i = 0;
 			cfg80211_chandef_create(&dflt_chandef,
-						&sband->channels[0],
+						&sband->channels[i],
 						NL80211_CHAN_NO_HT);
 			/* init channel we're on */
 			if (!local->use_chanctx && !local->_oper_chandef.chan) {



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux