[PATCH V1] netifd: fix wdev->data lifetime
John Crispin
john at phrozen.org
Tue Jun 23 05:40:28 EDT 2020
The reconf patch breaks wifi down under certain conditions. The root cause
is that during reload the wdev state gets flushed. This has the effect, that
the phy is lost from the state resulting in teardown breaking.
Fix this by changing the lifetime of wdev->data.
Signed-off-by: John Crispin <john at phrozen.org>
---
Changes in V2
* free() call was in the wrong place
wireless.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/wireless.c b/wireless.c
index efb7992..e295f28 100644
--- a/wireless.c
+++ b/wireless.c
@@ -275,8 +275,6 @@ wireless_device_free_state(struct wireless_device *wdev)
uloop_timeout_cancel(&wdev->script_check);
uloop_timeout_cancel(&wdev->timeout);
wireless_complete_kill_request(wdev);
- free(wdev->data);
- wdev->data = NULL;
vlist_for_each_element(&wdev->interfaces, vif, node) {
free(vif->data);
vif->data = NULL;
@@ -460,6 +458,7 @@ wireless_device_free(struct wireless_device *wdev)
vlist_flush_all(&wdev->vlans);
vlist_flush_all(&wdev->stations);
avl_delete(&wireless_devices.avl, &wdev->node.avl);
+ free(wdev->data);
free(wdev->config);
free(wdev->prev_config);
free(wdev);
@@ -1414,6 +1413,8 @@ wireless_device_notify(struct wireless_device *wdev, struct blob_attr *data,
if (*pdata)
return UBUS_STATUS_INVALID_ARGUMENT;
+ if (*pdata)
+ free(*pdata);
*pdata = blob_memdup(cur);
if (vif)
wireless_interface_set_data(vif);
--
2.25.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
http://lists.infradead.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list