Forráskód Böngészése

qcacmn: Avoid array out of bound access for current channels list

Currently regulatory computes the current channel list for band
6GHz by default which is not correct as current channel list
size is based on the CONFIG_BAND_6GHZ, if this feature is not
enabled then current channel list array will be accessed out of
bound inside reg modify channel list for band api.

To address above issue, move computation of current channel list
functionality inside CONFIG_BAND_6GHZ feature flag.

Change-Id: I4612c9d3adb027976a4404fb7c92c0e415014b47
CRs-Fixed: 2760541
Ashish Kumar Dhanotiya 4 éve
szülő
commit
3b654ef914
1 módosított fájl, 24 hozzáadás és 9 törlés
  1. 24 9
      umac/regulatory/core/src/reg_build_chan_list.c

+ 24 - 9
umac/regulatory/core/src/reg_build_chan_list.c

@@ -253,6 +253,27 @@ static void reg_modify_chan_list_for_indoor_channels(
 	}
 }
 
+#ifdef CONFIG_BAND_6GHZ
+static void reg_modify_chan_list_for_band_6G(
+					struct regulatory_channel *chan_list)
+{
+	enum channel_enum chan_enum;
+
+	reg_debug("disabling 6G");
+	for (chan_enum = MIN_6GHZ_CHANNEL;
+	     chan_enum <= MAX_6GHZ_CHANNEL; chan_enum++) {
+		chan_list[chan_enum].chan_flags |=
+			REGULATORY_CHAN_DISABLED;
+		chan_list[chan_enum].state = CHANNEL_STATE_DISABLE;
+	}
+}
+#else
+static inline void reg_modify_chan_list_for_band_6G(
+					struct regulatory_channel *chan_list)
+{
+}
+#endif
+
 /**
  * reg_modify_chan_list_for_band() - Based on the input band bitmap, either
  * disable 2GHz, 5GHz, or 6GHz channels.
@@ -287,15 +308,9 @@ static void reg_modify_chan_list_for_band(struct regulatory_channel *chan_list,
 		}
 	}
 
-	if (!(band_bitmap & BIT(REG_BAND_6G))) {
-		reg_debug("disabling 6G");
-		for (chan_enum = MIN_6GHZ_CHANNEL;
-		     chan_enum <= MAX_6GHZ_CHANNEL; chan_enum++) {
-			chan_list[chan_enum].chan_flags |=
-				REGULATORY_CHAN_DISABLED;
-			chan_list[chan_enum].state = CHANNEL_STATE_DISABLE;
-		}
-	}
+	if (!(band_bitmap & BIT(REG_BAND_6G)))
+		reg_modify_chan_list_for_band_6G(chan_list);
+
 }
 
 /**