ubus: check the l3_dev pointer before dereferencing it
authorFelix Fietkau <nbd@openwrt.org>
Sat, 19 Apr 2014 09:58:16 +0000 (11:58 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Sat, 19 Apr 2014 09:58:16 +0000 (11:58 +0200)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
ubus.c

diff --git a/ubus.c b/ubus.c
index 5cb54b1..aeb864f 100644 (file)
--- a/ubus.c
+++ b/ubus.c
@@ -650,7 +650,8 @@ netifd_dump_status(struct interface *iface)
        if (iface->state == IFS_UP) {
                time_t cur = system_get_rtime();
                blobmsg_add_u32(&b, "uptime", cur - iface->start_time);
        if (iface->state == IFS_UP) {
                time_t cur = system_get_rtime();
                blobmsg_add_u32(&b, "uptime", cur - iface->start_time);
-               blobmsg_add_string(&b, "l3_device", iface->l3_dev.dev->ifname);
+               if (iface->l3_dev.dev)
+                       blobmsg_add_string(&b, "l3_device", iface->l3_dev.dev->ifname);
        }
 
        if (iface->proto_handler)
        }
 
        if (iface->proto_handler)