Commit be689f68 authored by Johannes Berg's avatar Johannes Berg
Browse files

cfg80211: reject channels/chandefs with KHz offset >= 1000



This should be covered by the next MHz, make sure that the
numbers are always normalized.

Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Link: https://lore.kernel.org/r/20200424120103.12b91ecf75f9.I4bf499d58404283bbfacb517d614a816763bccf2@changeid


Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 3b23c184
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -147,6 +147,9 @@ bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef)
	if (!chandef->chan)
		return false;

	if (chandef->freq1_offset >= 1000)
		return false;

	control_freq = chandef->chan->center_freq;

	switch (chandef->width) {
+3 −0
Original line number Diff line number Diff line
@@ -834,6 +834,9 @@ int wiphy_register(struct wiphy *wiphy)
			sband->channels[i].orig_mpwr =
				sband->channels[i].max_power;
			sband->channels[i].band = band;

			if (WARN_ON(sband->channels[i].freq_offset >= 1000))
				return -EINVAL;
		}

		for (i = 0; i < sband->n_iftype_data; i++) {