]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
mesh: Fix random llid generation in an error case
authorJouni Malinen <jouni@codeaurora.org>
Mon, 15 Apr 2019 19:24:49 +0000 (22:24 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 15 Apr 2019 19:26:07 +0000 (22:26 +0300)
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: 5f92659d88f1 ("mesh: Add mesh peering manager")
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
wpa_supplicant/mesh_mpm.c

index 44859396c39939f30bfaa0a1322c7b0a46177c92..9d6ab8da1ebeb000cd6dcca333afb86efe9be527 100644 (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;