TDLS: Bail on STA add failure in tpk_m1 processing

The driver might not be able to add the TDLS STA. Fail if this happens.
Also fix the error path to always reset the TDLS peer data.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
This commit is contained in:
Arik Nemtsov 2014-06-10 21:19:05 +03:00 committed by Jouni Malinen
parent 947f900fb8
commit 342bce63cd

View file

@ -1848,7 +1848,6 @@ skip_rsn:
if (os_get_random(peer->rnonce, WPA_NONCE_LEN)) { if (os_get_random(peer->rnonce, WPA_NONCE_LEN)) {
wpa_msg(sm->ctx->ctx, MSG_WARNING, wpa_msg(sm->ctx->ctx, MSG_WARNING,
"TDLS: Failed to get random data for responder nonce"); "TDLS: Failed to get random data for responder nonce");
wpa_tdls_peer_free(sm, peer);
goto error; goto error;
} }
} }
@ -1904,8 +1903,10 @@ skip_rsn:
skip_rsn_check: skip_rsn_check:
/* add the peer to the driver as a "setup in progress" peer */ /* add the peer to the driver as a "setup in progress" peer */
wpa_sm_tdls_peer_addset(sm, peer->addr, 1, 0, 0, NULL, 0, NULL, NULL, 0, if (wpa_sm_tdls_peer_addset(sm, peer->addr, 1, 0, 0, NULL, 0, NULL,
NULL, 0, NULL, 0, NULL, 0); NULL, 0, NULL, 0, NULL, 0, NULL, 0))
goto error;
peer->tpk_in_progress = 1; peer->tpk_in_progress = 1;
wpa_printf(MSG_DEBUG, "TDLS: Sending TDLS Setup Response / TPK M2"); wpa_printf(MSG_DEBUG, "TDLS: Sending TDLS Setup Response / TPK M2");
@ -1919,6 +1920,7 @@ skip_rsn_check:
error: error:
wpa_tdls_send_error(sm, src_addr, WLAN_TDLS_SETUP_RESPONSE, dtoken, wpa_tdls_send_error(sm, src_addr, WLAN_TDLS_SETUP_RESPONSE, dtoken,
status); status);
wpa_tdls_peer_free(sm, peer);
return -1; return -1;
} }