mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-28 18:28:23 -05:00
nl80211: Fix wrong return code in set_key error path
Allow to abort key installations with different error codes and fix one misleading return code. Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
This commit is contained in:
parent
adf550ee4b
commit
8563f6f564
@ -3097,9 +3097,10 @@ static int wpa_driver_nl80211_set_key(struct i802_bss *bss,
|
||||
(drv->capa.flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE_8021X))
|
||||
return nl80211_set_pmk(drv, key, key_len, addr);
|
||||
|
||||
ret = -ENOBUFS;
|
||||
key_msg = nlmsg_alloc();
|
||||
if (!key_msg)
|
||||
return -ENOBUFS;
|
||||
return ret;
|
||||
|
||||
if (alg == WPA_ALG_NONE) {
|
||||
msg = nl80211_ifindex_msg(drv, ifindex, 0, NL80211_CMD_DEL_KEY);
|
||||
@ -3109,8 +3110,10 @@ static int wpa_driver_nl80211_set_key(struct i802_bss *bss,
|
||||
u32 suite;
|
||||
|
||||
suite = wpa_alg_to_cipher_suite(alg, key_len);
|
||||
if (!suite)
|
||||
if (!suite) {
|
||||
ret = -EINVAL;
|
||||
goto fail2;
|
||||
}
|
||||
msg = nl80211_ifindex_msg(drv, ifindex, 0, NL80211_CMD_NEW_KEY);
|
||||
if (!msg)
|
||||
goto fail2;
|
||||
@ -3179,9 +3182,10 @@ static int wpa_driver_nl80211_set_key(struct i802_bss *bss,
|
||||
!is_broadcast_ether_addr(addr))
|
||||
return ret;
|
||||
|
||||
ret = -ENOBUFS;
|
||||
key_msg = nlmsg_alloc();
|
||||
if (!key_msg)
|
||||
return -ENOBUFS;
|
||||
return ret;
|
||||
|
||||
msg = nl80211_ifindex_msg(drv, ifindex, 0, NL80211_CMD_SET_KEY);
|
||||
if (!msg)
|
||||
@ -3243,7 +3247,7 @@ fail:
|
||||
fail2:
|
||||
nl80211_nlmsg_clear(key_msg);
|
||||
nlmsg_free(key_msg);
|
||||
return -ENOBUFS;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user