Skip to content

Commit 4a5a61f

Browse files
jmalinenIgor
authored andcommitted
cfg80211: Fix validation of AKM suites
Incorrect variable was used in validating the akm_suites array from NL80211_ATTR_AKM_SUITES. In addition, there was no explicit validation of the array length (we only have room for NL80211_MAX_NR_AKM_SUITES). This can result in a buffer write overflow for stack variables with arbitrary data from user space. The nl80211 commands using the affected functionality require GENL_ADMIN_PERM, so this is only exposed to admin users. Cc: stable@kernel.org Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 2351d03 commit 4a5a61f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

net/wireless/nl80211.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4113,9 +4113,12 @@ static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev,
41134113
if (len % sizeof(u32))
41144114
return -EINVAL;
41154115

4116+
if (settings->n_akm_suites > NL80211_MAX_NR_AKM_SUITES)
4117+
return -EINVAL;
4118+
41164119
memcpy(settings->akm_suites, data, len);
41174120

4118-
for (i = 0; i < settings->n_ciphers_pairwise; i++)
4121+
for (i = 0; i < settings->n_akm_suites; i++)
41194122
if (!nl80211_valid_akm_suite(settings->akm_suites[i]))
41204123
return -EINVAL;
41214124
}

0 commit comments

Comments
 (0)