From 5a4ac30c7a15712d01110befec1acfe86c2cbed0 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 27 Sep 2021 18:56:21 +0200 Subject: netifd: rework/fix device free handling Instead of explicitly preventing free in specific code sections using device_lock/device_unlock, defer all device free handling via uloop timeout This avoids an entire class of lurking use-after-free bugs triggered by device event processing and simplifies the code Signed-off-by: Felix Fietkau --- extdev.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'extdev.c') diff --git a/extdev.c b/extdev.c index 977d9c2..5c5e769 100644 --- a/extdev.c +++ b/extdev.c @@ -942,11 +942,9 @@ __create(const char *name, struct device_type *type, struct blob_attr *config) inv_error: extdev_invocation_error(ret, __extdev_methods[METHOD_CREATE], name); error: - device_lock(); free(edev->dev.config); device_cleanup(&edev->dev); free(edev); - device_unlock(); netifd_log_message(L_WARNING, "Failed to create %s %s\n", type->name, name); return NULL; } -- cgit v1.2.1