diff options
author | Felix Fietkau <nbd@openwrt.org> | 2012-03-19 21:38:13 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2012-03-19 21:38:13 +0100 |
commit | 49bf4946296b22f7c26594ac310879d6059344d4 (patch) | |
tree | 16487b1d5160002e50869a1d401ea3a8a7108398 | |
parent | cfeabcaf0e69b02bac6c86edc223d2eb2e2367d3 (diff) |
move device cleanup to common code, fixes use-after-free in tunnel code
-rw-r--r-- | bridge.c | 1 | ||||
-rw-r--r-- | device.c | 4 |
2 files changed, 1 insertions, 4 deletions
@@ -343,7 +343,6 @@ bridge_free(struct device *dev) { struct bridge_state *bst; - device_cleanup(dev); bst = container_of(dev, struct bridge_state, dev); vlist_flush_all(&bst->members); free(bst); @@ -112,7 +112,6 @@ static void simple_device_free(struct device *dev) { if (dev->parent.dev) device_remove_user(&dev->parent); - device_cleanup(dev); free(dev); } @@ -162,8 +161,6 @@ static void alias_device_free(struct device *dev) { struct alias_device *alias; - device_cleanup(dev); - alias = container_of(dev, struct alias_device, dev); avl_delete(&aliases, &alias->avl); free(alias); @@ -483,6 +480,7 @@ device_free(struct device *dev) { __devlock++; free(dev->config); + device_cleanup(dev); dev->type->free(dev); __devlock--; } |