diff options
author | Hans Dedecker <dedeckeh@gmail.com> | 2014-05-07 09:19:09 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2014-05-09 15:50:33 +0200 |
commit | 8714f17ad66fa29383170ad45b9c150b9818dbdf (patch) | |
tree | f7a64e764faaa76705d25acf47f62d2f762abb00 | |
parent | 4b7662c5841214c105a174fdc9ab9fac870abab9 (diff) |
netifd: Fix node version set after free
Fixes an issue where a bridge member will be removed from the bridge
upon an interface ifup as the bridge node version -1 is overwritten
by vlist_add while the new created bridge member pointer is freed in
bridge_member_update
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
-rw-r--r-- | bridge.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -344,7 +344,11 @@ bridge_create_member(struct bridge_state *bst, struct device *dev, bool hotplug) strcpy(bm->name, dev->ifname); bm->dev.dev = dev; vlist_add(&bst->members, &bm->node, bm->name); - if (hotplug) + // Need to look up the bridge member again as the above + // created pointer will be freed in case the bridge member + // already existed + bm = vlist_find(&bst->members, dev->ifname, bm, node); + if (hotplug && bm) bm->node.version = -1; return bm; |