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))
|
(drv->capa.flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE_8021X))
|
||||||
return nl80211_set_pmk(drv, key, key_len, addr);
|
return nl80211_set_pmk(drv, key, key_len, addr);
|
||||||
|
|
||||||
|
ret = -ENOBUFS;
|
||||||
key_msg = nlmsg_alloc();
|
key_msg = nlmsg_alloc();
|
||||||
if (!key_msg)
|
if (!key_msg)
|
||||||
return -ENOBUFS;
|
return ret;
|
||||||
|
|
||||||
if (alg == WPA_ALG_NONE) {
|
if (alg == WPA_ALG_NONE) {
|
||||||
msg = nl80211_ifindex_msg(drv, ifindex, 0, NL80211_CMD_DEL_KEY);
|
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;
|
u32 suite;
|
||||||
|
|
||||||
suite = wpa_alg_to_cipher_suite(alg, key_len);
|
suite = wpa_alg_to_cipher_suite(alg, key_len);
|
||||||
if (!suite)
|
if (!suite) {
|
||||||
|
ret = -EINVAL;
|
||||||
goto fail2;
|
goto fail2;
|
||||||
|
}
|
||||||
msg = nl80211_ifindex_msg(drv, ifindex, 0, NL80211_CMD_NEW_KEY);
|
msg = nl80211_ifindex_msg(drv, ifindex, 0, NL80211_CMD_NEW_KEY);
|
||||||
if (!msg)
|
if (!msg)
|
||||||
goto fail2;
|
goto fail2;
|
||||||
|
@ -3179,9 +3182,10 @@ static int wpa_driver_nl80211_set_key(struct i802_bss *bss,
|
||||||
!is_broadcast_ether_addr(addr))
|
!is_broadcast_ether_addr(addr))
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
ret = -ENOBUFS;
|
||||||
key_msg = nlmsg_alloc();
|
key_msg = nlmsg_alloc();
|
||||||
if (!key_msg)
|
if (!key_msg)
|
||||||
return -ENOBUFS;
|
return ret;
|
||||||
|
|
||||||
msg = nl80211_ifindex_msg(drv, ifindex, 0, NL80211_CMD_SET_KEY);
|
msg = nl80211_ifindex_msg(drv, ifindex, 0, NL80211_CMD_SET_KEY);
|
||||||
if (!msg)
|
if (!msg)
|
||||||
|
@ -3243,7 +3247,7 @@ fail:
|
||||||
fail2:
|
fail2:
|
||||||
nl80211_nlmsg_clear(key_msg);
|
nl80211_nlmsg_clear(key_msg);
|
||||||
nlmsg_free(key_msg);
|
nlmsg_free(key_msg);
|
||||||
return -ENOBUFS;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue