cfg80211: retrieve S1G operating channel number
PATCH 1/1 cfg80211: retrieve S1G operating channel number
When retrieving the S1G channel number from IEs, we should retrieve the operating channel instead of the primary channel. The S1G operation element specifies the main channel of operation as the oper channel, unlike for HT and HE which specify their main channel of operation as the primary channel.
Signed-off-by Kieran Frewen <[email protected]>
Signed-off-by Bassem Dawood <[email protected]>
--- net/wireless/scan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/wireless/scan.c +1 -1
@@ -1829,7 +1829,7 @@ int cfg80211_get_ies_channel_number(const u8 *ie, size_t ielen,if (tmp && tmp->datalen >=sizeof (struct ieee80211_s1g_oper_ie )) {struct ieee80211_s1g_oper_ie *s1gop = (void *)tmp->data; -return s1gop->primary_ch; +return s1gop->oper_ch; } }else { tmp =cfg80211_find_elem (WLAN_EID_DS_PARAMS , ie, ielen);
Signature · 1 line
2.25.1
PATCH 1/1 nl80211: validate S1G channel width
Validate the S1G channel width input by user to ensure it matches that of the requested channel
Signed-off-by Kieran Frewen <[email protected]>
Signed-off-by Bassem Dawood <[email protected]>
--- net/wireless/nl80211.c | 9 +++++++++ 1 file changed, 9 insertions(+)
net/wireless/nl80211.c +9 -0
@@ -3172,6 +3172,15 @@ int nl80211_parse_chandef(struct cfg80211_registered_device *rdev, }else if (attrs[NL80211_ATTR_CHANNEL_WIDTH ]) { chandef->width =nla_get_u32 (attrs[NL80211_ATTR_CHANNEL_WIDTH ]); +if (chandef->chan->band ==NL80211_BAND_S1GHZ ) { +/* User input error for channel width doesn't match channel */ +if (chandef->width !=ieee80211_s1g_channel_width (chandef->chan)) { +NL_SET_ERR_MSG_ATTR (extack, + attrs[NL80211_ATTR_CHANNEL_WIDTH ], +"bad channel width" ); +return -EINVAL ; + } + }if (attrs[NL80211_ATTR_CENTER_FREQ1 ]) { chandef->center_freq1 =nla_get_u32 (attrs[NL80211_ATTR_CENTER_FREQ1 ]);
Signature · 1 line
2.25.1