Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 386b1f27 authored by Johannes Berg's avatar Johannes Berg
Browse files

nl80211: only allow WEP keys during connect command



This was already documented that way in nl80211.h, but the
parsing code still accepted other key types. Change it to
really only accept WEP keys as documented.

Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 42ee231c
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -881,17 +881,20 @@ nl80211_parse_connkeys(struct cfg80211_registered_device *rdev,
						     parse.idx, false, NULL);
		if (err)
			goto error;
		if (parse.p.cipher != WLAN_CIPHER_SUITE_WEP40 &&
		    parse.p.cipher != WLAN_CIPHER_SUITE_WEP104) {
			err = -EINVAL;
			goto error;
		}
		result->params[parse.idx].cipher = parse.p.cipher;
		result->params[parse.idx].key_len = parse.p.key_len;
		result->params[parse.idx].key = result->data[parse.idx];
		memcpy(result->data[parse.idx], parse.p.key, parse.p.key_len);

		if (parse.p.cipher == WLAN_CIPHER_SUITE_WEP40 ||
		    parse.p.cipher == WLAN_CIPHER_SUITE_WEP104) {
		/* must be WEP key if we got here */
		if (no_ht)
			*no_ht = true;
	}
	}

	return result;
 error: