mesh: Fix random llid generation in an error case

If os_get_random() fails, llid must not be read/used since it could be
uninitialized. Handle that special case by clearing llid explicitly to 0
to continue iteration.

Fixes: 5f92659d88 ("mesh: Add mesh peering manager")
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2019-04-15 22:24:49 +03:00 committed by Jouni Malinen
parent 10cf866bac
commit 984d5b7e1f

View file

@ -189,7 +189,7 @@ static void mesh_mpm_init_link(struct wpa_supplicant *wpa_s,
do {
if (os_get_random((u8 *) &llid, sizeof(llid)) < 0)
continue;
llid = 0; /* continue */
} while (!llid || llid_in_use(wpa_s, llid));
sta->my_lid = llid;