3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-30 06:02:39 +01:00

mschapv2: Call set_key_material last in handle_success

Make sure that eap_set_key_material can free the whole EAP method and
EAP state machine before returning, by calling that function last.  This
relies on eap_mschapv2_handle_success being the last call in about 5
stack frames above it too.
This commit is contained in:
Andrew Zaborowski 2017-01-06 02:51:17 -05:00 committed by Denis Kenzior
parent 15f4ddfaa6
commit c5906d1c20

View File

@ -559,12 +559,13 @@ static void eap_mschapv2_handle_success(struct eap_state *eap,
goto err;
eap_method_success(eap);
/* The eapol set_key_material only needs msk, and that's all we got */
eap_set_key_material(eap, session_key, 32, NULL, 0, NULL, 0);
buffer[5] = MSCHAPV2_OP_SUCCESS;
eap_send_response(eap, EAP_TYPE_MSCHAPV2, buffer, sizeof(buffer));
/* The eapol set_key_material only needs msk, and that's all we got */
eap_set_key_material(eap, session_key, 32, NULL, 0, NULL, 0);
return;
err: