From 87e469be0c08db92b0fb0f4817cc177c158cdf42 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 18 May 2021 06:20:00 +0200 Subject: wireless: fix memory corruption bug when using vlans/station entries in the config On config reload, any vif entries in the config added to the vlist will be matched against existing ones, and the old entries preserved. This means that the vif pointer is no longer valid after vlist_add. Look up the vif again before using it for vlan/station entries. Signed-off-by: Felix Fietkau --- wireless.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wireless.c b/wireless.c index 818f7c9..c465a16 100644 --- a/wireless.c +++ b/wireless.c @@ -1129,7 +1129,8 @@ struct wireless_interface* wireless_interface_create(struct wireless_device *wde vif->isolate = false; vlist_add(&wdev->interfaces, &vif->node, vif->name); - return vif; + + return vlist_find(&wdev->interfaces, name, vif, node); } static void -- cgit v1.2.1