summaryrefslogtreecommitdiffhomepage
path: root/vlandev.c
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2015-02-12 17:41:16 +0100
committerSteven Barth <steven@midlink.org>2015-02-17 15:12:03 +0100
commit2af71375f7a03d78dc9e3e4155e59e51f17a8327 (patch)
treedac6a1524d5784722448f11d29a1fb6c851c4cd2 /vlandev.c
parent5a0909caaff498d61b5cf17162fd0c5c5b381b8b (diff)
netifd: Keep reference to a config copy in device type specific reload handler as the original config pointer might go stale
Fixes random observed crashes in blobmsg_parse when device type specific config data is parsed. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'vlandev.c')
-rw-r--r--vlandev.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/vlandev.c b/vlandev.c
index 7b2038e..884e6ef 100644
--- a/vlandev.c
+++ b/vlandev.c
@@ -131,6 +131,7 @@ vlandev_free(struct device *dev)
mvdev = container_of(dev, struct vlandev_device, dev);
device_remove_user(&mvdev->parent);
+ free(mvdev->config_data);
free(mvdev);
}
@@ -185,6 +186,7 @@ vlandev_reload(struct device *dev, struct blob_attr *attr)
struct vlandev_device *mvdev;
mvdev = container_of(dev, struct vlandev_device, dev);
+ attr = blob_memdup(attr);
blobmsg_parse(device_attr_list.params, __DEV_ATTR_MAX, tb_dev,
blob_data(attr), blob_len(attr));
@@ -214,6 +216,7 @@ vlandev_reload(struct device *dev, struct blob_attr *attr)
vlandev_config_init(dev);
}
+ free(mvdev->config_data);
mvdev->config_data = attr;
return ret;
}