mesh: fix crash with CONFIG_TAXONOMY enabled

Message ID 20180503103615.43710-1-nbd@nbd.name
State Accepted
Headers show
Series
  • mesh: fix crash with CONFIG_TAXONOMY enabled
Related show

Commit Message

Felix Fietkau May 3, 2018, 10:36 a.m.
wpa_s->ifmsh needs to be allocated using hostapd_alloc_iface() instead
of a direct call to os_zalloc, otherwise the linked list for station
taxonomy items remains uninitialized, leading to a crash on the first
attempt to traverse that list

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 wpa_supplicant/mesh.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jouni Malinen May 31, 2018, 1:16 p.m. | #1
On Thu, May 03, 2018 at 12:36:15PM +0200, Felix Fietkau wrote:
> wpa_s->ifmsh needs to be allocated using hostapd_alloc_iface() instead
> of a direct call to os_zalloc, otherwise the linked list for station
> taxonomy items remains uninitialized, leading to a crash on the first
> attempt to traverse that list

Thanks, applied. This is clearly correct thing to do, but I'd note that
CONFIG_TAXONOMY is not something that the current hostap.git repository
would enable for wpa_supplicant builds.

Patch

diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c
index 19b66b4b0..c4f167e1c 100644
--- a/wpa_supplicant/mesh.c
+++ b/wpa_supplicant/mesh.c
@@ -169,7 +169,7 @@  static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s,
 		return 0;
 	}
 
-	wpa_s->ifmsh = ifmsh = os_zalloc(sizeof(*wpa_s->ifmsh));
+	wpa_s->ifmsh = ifmsh = hostapd_alloc_iface();
 	if (!ifmsh)
 		return -ENOMEM;