interface: fix NULL pointer defref in interface_set_main_dev
authorFelix Fietkau <nbd@openwrt.org>
Tue, 18 Jun 2013 16:24:37 +0000 (18:24 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 18 Jun 2013 16:24:51 +0000 (18:24 +0200)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
interface.c

index 81de337e05d5347724ace34b531a98e59839815d..ddbdca9122a9ce1e1b00b3a70d442cb53d4260b8 100644 (file)
@@ -675,6 +675,9 @@ interface_set_main_dev(struct interface *iface, struct device *dev)
                interface_set_l3_dev(iface, dev);
 
        device_add_user(&iface->main_dev, dev);
+       if (!dev)
+               return;
+
        if (claimed)
                device_claim(&iface->l3_dev);