nl80211/cfg80211: add nla_policy for S1G band
Subsystems (3)
PATCH v2 1/1 nl80211/cfg80211: add nla_policy for S1G band
Our detector has identified another case of an incomplete policy. Specifically, the commit df78a0c0b67d ("nl80211: S1G band and channel definitions") introduced the NL80211_BAND_S1GHZ attribute to nl80211_band, but it neglected to update the nl80211_match_band_rssi_policy accordingly.
Similar commits that add new band types, such as the initial commit 1e1b11b6a111 ("nl80211/cfg80211: Specify band specific min RSSI thresholds with sched scan"), the commit e548a1c36b11 ("cfg80211: add 6GHz in code handling array with NUM_NL80211_BANDS entries"), and the commit 63fa04266629 ("nl80211: Add LC placeholder band definition to nl80211_band"), all require updates to the policy.
Failure to do so could result in accessing an attribute of unexpected length in the function nl80211_parse_sched_scan_per_band_rssi.
To resolve this issue, this commit adds the policy for the NL80211_BAND_S1GHZ attribute.
---
V1 -> V2: change net-next to wireless as suggested
net/wireless/nl80211.c | 1 + 1 file changed, 1 insertion(+)
net/wireless/nl80211.c +1 -0
@@ -911,6 +911,7 @@ nl80211_match_band_rssi_policy[NUM_NL80211_BANDS] = { [NL80211_BAND_5GHZ] = { .type = NLA_S32 }, [NL80211_BAND_6GHZ] = { .type = NLA_S32 }, [NL80211_BAND_60GHZ] = { .type = NLA_S32 }, + [NL80211_BAND_S1GHZ] = { .type = NLA_S32 }, [NL80211_BAND_LC] = { .type = NLA_S32 }, };
Signature · 1 line
2.34.1
Johannes Berg
maintainerQuoted 2 lines · Lin Ma
V1 -> V2: change net-next to wireless as suggested
For the record, I don't think anyone is using scheduled scan with S1G or even _could_ be doing that (is there even a driver other than hwsim?), so I don't think I'll apply this for wireless. No need to resend (again) though :)
johannes
Quoted 31 lines · Lin Ma
Our detector has identified another case of an incomplete policy. Specifically, the commit
df78a0c0b67d("nl80211: S1G band and channel definitions") introduced theNL80211_BAND_S1GHZattribute tonl80211_band, but it neglected to update thenl80211_match_band_rssi_policyaccordingly.Similar commits that add new band types, such as the initial commit
1e1b11b6a111("nl80211/cfg80211: Specify band specific min RSSI thresholds with sched scan"), the commite548a1c36b11("cfg80211: add 6GHz in code handling array withNUM_NL80211_BANDSentries"), and the commit63fa04266629("nl80211: Add LC placeholder band definition tonl80211_band"), all require updates to the policy.
Failure to do so could result in accessing an attribute of unexpected length in the functionnl80211_parse_sched_scan_per_band_rssi.To resolve this issue, this commit adds the policy for the
NL80211_BAND_S1GHZattribute.Fixes df78a0c0b67d ("nl80211: S1G band and channel definitions")Signed-off-by Lin Ma <[email protected]>---
V1 -> V2: change net-next to wireless as suggestednet/wireless/nl80211.c | 1 + 1 file changed, 1 insertion(+)net/wireless/nl80211.c +0
-0
net/wireless/nl80211.c nl80211_match_band_rssi_policy[NUM_NL80211_BANDS] = { · line 917
Quoted 7 lines
net/wireless/nl80211.c +1
-0@@ -911,6 +911,7 @@ nl80211_match_band_rssi_policy[NUM_NL80211_BANDS] = { [NL80211_BAND_5GHZ] = { .type = NLA_S32 }, [NL80211_BAND_6GHZ] = { .type = NLA_S32 }, [NL80211_BAND_60GHZ] = { .type = NLA_S32 }, + [NL80211_BAND_S1GHZ] = { .type = NLA_S32 }, [NL80211_BAND_LC] = { .type = NLA_S32 }, };
something is really suspicious since the NL80211_BAND_* enums are *value* enums, not attribute ID enums, and hence they should never be used in an nla_policy.
what is actually using these as attribute IDs, noting that NL80211_BAND_2GHZ == 0 and hence cannot be used as an attribute ID
seems the logic that introduced this policy needs to be revisited.
Johannes Berg
maintainerQuoted 5 lines · Jeff Johnson
Quoted 5 lines
net/wireless/nl80211.c +0
-0@@ -911,6 +911,7 @@ nl80211_match_band_rssi_policy[NUM_NL80211_BANDS] = { [NL80211_BAND_5GHZ] = { .type = NLA_S32 }, [NL80211_BAND_6GHZ] = { .type = NLA_S32 },
Quoted 8 lines
net/wireless/nl80211.c nl80211_match_band_rssi_policy[NUM_NL80211_BANDS] = { · line 917
Quoted 5 lines
net/wireless/nl80211.c +1
-0[NL80211_BAND_60GHZ] = { .type = NLA_S32 }, + [NL80211_BAND_S1GHZ] = { .type = NLA_S32 }, [NL80211_BAND_LC] = { .type = NLA_S32 }, };something is really suspicious since the NL80211_BAND_* enums are *value* enums, not attribute ID enums, and hence they should never be used in an
nla_policy.
Yeah, that's what it looks like first, but then they do get used anyway...
Quoted 2 lines
what is actually using these as attribute IDs, noting that
NL80211_BAND_2GHZ== 0 and hence cannot be used as an attribute ID
Ohh. Good catch!
Quoted 2 lines
seems the logic that introduced this policy needs to be revisited.
Let's just remove it?
commit 1e1b11b6a1111cd9e8af1fd6ccda270a9fa3eacf
Author: vamsi krishna <[email protected]> Date: Fri Feb 1 18:34:51 2019 +0530
nl80211/cfg80211: Specify band specific min RSSI thresholds with sched scan
As far as I can tell nothing is using that in the first place ... Certainly not in the kernel, nor wpa_s, nor anything else I could find really ...
We can't completely revert it since we need the attribute number to stay allocated, but that's all we cannot remove.
johannes
Quoted 35 lines · Johannes Berg
Quoted 5 lines · Jeff Johnson
Quoted 5 lines
net/wireless/nl80211.c +0
-0@@ -911,6 +911,7 @@ nl80211_match_band_rssi_policy[NUM_NL80211_BANDS] = { [NL80211_BAND_5GHZ] = { .type = NLA_S32 }, [NL80211_BAND_6GHZ] = { .type = NLA_S32 },Quoted 8 lines
net/wireless/nl80211.c nl80211_match_band_rssi_policy[NUM_NL80211_BANDS] = { · line 917
Quoted 5 lines
net/wireless/nl80211.c +1
-0[NL80211_BAND_60GHZ] = { .type = NLA_S32 }, + [NL80211_BAND_S1GHZ] = { .type = NLA_S32 }, [NL80211_BAND_LC] = { .type = NLA_S32 }, };something is really suspicious since the NL80211_BAND_* enums are *value* enums, not attribute ID enums, and hence they should never be used in an
nla_policy.Yeah, that's what it looks like first, but then they do get used anyway...
Quoted 2 lines
what is actually using these as attribute IDs, noting that
NL80211_BAND_2GHZ== 0 and hence cannot be used as an attribute IDOhh. Good catch!
Quoted 2 lines
seems the logic that introduced this policy needs to be revisited.
Let's just remove it?
commit
1e1b11b6a1111cd9e8af1fd6ccda270a9fa3eacfAuthor: vamsi krishna <[email protected]> Date: Fri Feb 1 18:34:51 2019 +0530nl80211/cfg80211: Specify band specific min RSSI thresholds with sched scan
Quoted 6 lines
As far as I can tell nothing is using that in the first place ... Certainly not in the kernel, nor
wpa_s, nor anything else I could find really ...We can't completely revert it since we need the attribute number to stay allocated, but that's all we cannot remove.
I'm investigating this and will report back.
Quoted 36 lines · Jeff Johnson
Quoted 35 lines · Johannes Berg
Quoted 5 lines · Jeff Johnson
Quoted 5 lines
net/wireless/nl80211.c +0
-0@@ -911,6 +911,7 @@ nl80211_match_band_rssi_policy[NUM_NL80211_BANDS] = { [NL80211_BAND_5GHZ] = { .type = NLA_S32 }, [NL80211_BAND_6GHZ] = { .type = NLA_S32 },Quoted 8 lines
net/wireless/nl80211.c nl80211_match_band_rssi_policy[NUM_NL80211_BANDS] = { · line 917
Quoted 5 lines
net/wireless/nl80211.c +1
-0[NL80211_BAND_60GHZ] = { .type = NLA_S32 }, + [NL80211_BAND_S1GHZ] = { .type = NLA_S32 }, [NL80211_BAND_LC] = { .type = NLA_S32 }, };something is really suspicious since the NL80211_BAND_* enums are *value* enums, not attribute ID enums, and hence they should never be used in an
nla_policy.Yeah, that's what it looks like first, but then they do get used anyway...
Quoted 2 lines
what is actually using these as attribute IDs, noting that
NL80211_BAND_2GHZ== 0 and hence cannot be used as an attribute IDOhh. Good catch!
Quoted 2 lines
seems the logic that introduced this policy needs to be revisited.
Let's just remove it?
commit
1e1b11b6a1111cd9e8af1fd6ccda270a9fa3eacfAuthor: vamsi krishna <[email protected]> Date: Fri Feb 1 18:34:51 2019 +0530nl80211/cfg80211: Specify band specific min RSSI thresholds with sched scan
Quoted 8 lines
Quoted 6 lines
As far as I can tell nothing is using that in the first place ... Certainly not in the kernel, nor
wpa_s, nor anything else I could find really ...We can't completely revert it since we need the attribute number to stay allocated, but that's all we cannot remove.
I'm investigating this and will report back.
OK, I have investigated this and based upon the investigation this can be removed (except for keeping the now obsolete uapi bits). This was done in preparation for supporting a new Android interface in the out-of-tree Android driver, but that interface was subsequently withdrawn by Google.
Johannes, do you want to handle this? Or should I?
/jeff
Johannes Berg
maintainerQuoted 8 lines · Jeff Johnson
OK, I have investigated this and based upon the investigation this can be removed (except for keeping the now obsolete uapi bits). This was done in preparation for supporting a new Android interface in the out-of-tree Android driver, but that interface was subsequently withdrawn by Google.
Johannes, do you want to handle this? Or should I?
Would be great if you could send a patch, thanks!
johannes