fix device_lock/device_unlock imbalance in the hotplug device handling
[project/netifd.git] / ubus.c
diff --git a/ubus.c b/ubus.c
index 2f0019c..742cc43 100644 (file)
--- a/ubus.c
+++ b/ubus.c
@@ -496,7 +496,8 @@ netifd_handle_status(struct ubus_context *ctx, struct ubus_object *obj,
                blobmsg_add_string(&b, "proto", iface->proto_handler->name);
 
        dev = iface->main_dev.dev;
-       if (dev && !(iface->proto_handler->flags & PROTO_FLAG_NODEV))
+       if (dev && !dev->hidden &&
+           !(iface->proto_handler->flags & PROTO_FLAG_NODEV))
                blobmsg_add_string(&b, "device", dev->ifname);
 
        if (iface->state == IFS_UP) {
@@ -562,9 +563,9 @@ netifd_iface_handle_device(struct ubus_context *ctx, struct ubus_object *obj,
                return UBUS_STATUS_NOT_FOUND;
 
        if (add)
-               return interface_add_link(iface, dev);
+               ret = interface_add_link(iface, dev);
        else
-               return interface_remove_link(iface, dev);
+               ret = interface_remove_link(iface, dev);
 
        device_unlock();