Skip to content

Commit d7f13f7

Browse files
Srinivas Dasarijmberg-intel
authored andcommitted
cfg80211: Validate frequencies nested in NL80211_ATTR_SCAN_FREQUENCIES
validate_scan_freqs() retrieves frequencies from attributes nested in the attribute NL80211_ATTR_SCAN_FREQUENCIES with nla_get_u32(), which reads 4 bytes from each attribute without validating the size of data received. Attributes nested in NL80211_ATTR_SCAN_FREQUENCIES don't have an nla policy. Validate size of each attribute before parsing to avoid potential buffer overread. Fixes: 2a51931 ("cfg80211/nl80211: scanning (and mac80211 update to use it)") Cc: stable@vger.kernel.org Signed-off-by: Srinivas Dasari <dasaris@qti.qualcomm.com> Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 8feb69c commit d7f13f7

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎net/wireless/nl80211.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6469,6 +6469,10 @@ static int validate_scan_freqs(struct nlattr *freqs)
64696469
struct nlattr *attr1, *attr2;
64706470
int n_channels = 0, tmp1, tmp2;
64716471

6472+
nla_for_each_nested(attr1, freqs, tmp1)
6473+
if (nla_len(attr1) != sizeof(u32))
6474+
return 0;
6475+
64726476
nla_for_each_nested(attr1, freqs, tmp1) {
64736477
n_channels++;
64746478
/*

0 commit comments

Comments
 (0)