mka: Avoid inconsistent state in ieee802_1x_kay_move_live_peer()
If the memory allocation in ieee802_1x_kay_init_receive_sc() fails, we end up in an inconsistent state where the peer is moved to the live peers list and its sci is setup, but we don't have an rxsc. Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
This commit is contained in:
parent
12447457bf
commit
90bff0e2aa
1 changed files with 5 additions and 4 deletions
|
@ -604,6 +604,11 @@ ieee802_1x_kay_move_live_peer(struct ieee802_1x_mka_participant *participant,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rxsc = ieee802_1x_kay_init_receive_sc(&participant->current_peer_sci,
|
||||||
|
sc_ch);
|
||||||
|
if (!rxsc)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
os_memcpy(&peer->sci, &participant->current_peer_sci,
|
os_memcpy(&peer->sci, &participant->current_peer_sci,
|
||||||
sizeof(peer->sci));
|
sizeof(peer->sci));
|
||||||
peer->mn = mn;
|
peer->mn = mn;
|
||||||
|
@ -620,10 +625,6 @@ ieee802_1x_kay_move_live_peer(struct ieee802_1x_mka_participant *participant,
|
||||||
|
|
||||||
secy_get_available_receive_sc(participant->kay, &sc_ch);
|
secy_get_available_receive_sc(participant->kay, &sc_ch);
|
||||||
|
|
||||||
rxsc = ieee802_1x_kay_init_receive_sc(&peer->sci, sc_ch);
|
|
||||||
if (!rxsc)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
dl_list_add(&participant->rxsc_list, &rxsc->list);
|
dl_list_add(&participant->rxsc_list, &rxsc->list);
|
||||||
secy_create_receive_sc(participant->kay, rxsc);
|
secy_create_receive_sc(participant->kay, rxsc);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue