From 984d5b7e1fdd6c23337445ed08b2bd0b65504084 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 15 Apr 2019 22:24:49 +0300 Subject: [PATCH] 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: 5f92659d88f1 ("mesh: Add mesh peering manager") Signed-off-by: Jouni Malinen --- wpa_supplicant/mesh_mpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wpa_supplicant/mesh_mpm.c b/wpa_supplicant/mesh_mpm.c index 44859396c..9d6ab8da1 100644 --- a/wpa_supplicant/mesh_mpm.c +++ b/wpa_supplicant/mesh_mpm.c @@ -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;