wireless: fix memory corruption bug when using vlans/station entries in the config
authorFelix Fietkau <nbd@nbd.name>
Tue, 18 May 2021 04:20:00 +0000 (06:20 +0200)
committerFelix Fietkau <nbd@nbd.name>
Tue, 18 May 2021 04:20:01 +0000 (06:20 +0200)
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 <nbd@nbd.name>
wireless.c

index 818f7c994da8851cefc550793a267f3c758a50fa..c465a16590edb96fa16c17d92bfbe80fbeacd2e3 100644 (file)
@@ -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