wireguard: add local variable in handshake process
Originally handshake process gets pointer to value of index peer. In the meantime this pointer can be invalid due to resize hash table for wireguard and passed poison value to another function. The fixes add local variable to keep index of peer instead of value from pointer. Type: fix Signed-off-by: Gabriel Oginski <gabrielx.oginski@intel.com> Change-Id: I1b2535c44b4f987d19077c75c778aaa5ed71a457
This commit is contained in:
committed by
Fan Zhang
parent
d431d7404d
commit
f33979ba88
@@ -245,12 +245,14 @@ wg_handshake_process (vlib_main_t *vm, wg_main_t *wmp, vlib_buffer_t *b,
|
||||
case MESSAGE_HANDSHAKE_RESPONSE:
|
||||
{
|
||||
message_handshake_response_t *resp = current_b_data;
|
||||
index_t peeri = INDEX_INVALID;
|
||||
u32 *entry =
|
||||
wg_index_table_lookup (&wmp->index_table, resp->receiver_index);
|
||||
|
||||
if (PREDICT_TRUE (entry != NULL))
|
||||
{
|
||||
peer = wg_peer_get (*entry);
|
||||
peeri = *entry;
|
||||
peer = wg_peer_get (peeri);
|
||||
if (wg_peer_is_dead (peer))
|
||||
return WG_INPUT_ERROR_PEER;
|
||||
}
|
||||
@@ -282,7 +284,7 @@ wg_handshake_process (vlib_main_t *vm, wg_main_t *wmp, vlib_buffer_t *b,
|
||||
}
|
||||
else
|
||||
{
|
||||
wg_peer_update_flags (*entry, WG_PEER_ESTABLISHED, true);
|
||||
wg_peer_update_flags (peeri, WG_PEER_ESTABLISHED, true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user