summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2021-05-18 06:20:00 +0200
committerFelix Fietkau <nbd@nbd.name>2021-05-18 06:20:01 +0200
commit87e469be0c08db92b0fb0f4817cc177c158cdf42 (patch)
tree09e167bea078cf64d13217570290f003ea7d5ff0
parent2a97fd006c3b09c1aeab30ac881c9ac902365d57 (diff)
downloadnetifd-87e469be0c08db92b0fb0f4817cc177c158cdf42.tar.gz
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 <nbd@nbd.name>
-rw-r--r--wireless.c3
1 files changed, 2 insertions, 1 deletions
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