]> git.hungrycats.org Git - linux/commitdiff
[VLAN]: Fix OOPS on module removal.
authorEran Mann <emann@mrv.com>
Wed, 20 Aug 2003 04:35:59 +0000 (21:35 -0700)
committerDavid S. Miller <davem@kernel.bkbits.net>
Wed, 20 Aug 2003 04:35:59 +0000 (21:35 -0700)
The current code attempts to add a proc entry for each vlan device,
however there is no check whether this attempt succeeded. When a device
is unregistered it tries to remove the proc entry, if none was added
the oops follows...

net/8021q/vlan.c
net/8021q/vlanproc.c

index 03f7077524f5bd5f5e9d6ce519a329cc44f97ec2..7efda3575e404ea8342947ee40ff4648a1e79856 100644 (file)
@@ -547,7 +547,9 @@ static struct net_device *register_vlan_device(const char *eth_IF_name,
            
        grp->vlan_devices[VLAN_ID] = new_dev;
 
-       vlan_proc_add_dev(new_dev); /* create it's proc entry */
+       if (vlan_proc_add_dev(new_dev)<0)/* create it's proc entry */
+               printk(KERN_WARNING "VLAN: failed to add proc entry for %s\n",
+                                                        new_dev->name);
 
        if (real_dev->features & NETIF_F_HW_VLAN_FILTER)
                real_dev->vlan_rx_add_vid(real_dev, VLAN_ID);
index 58233aa087aa6e05daacaeeb5266ee59ec83fa32..e4cf6c0757df6d3186cd62e604284a045c74cb42 100644 (file)
@@ -228,8 +228,10 @@ int vlan_proc_rem_dev(struct net_device *vlandev)
 #endif
 
        /** NOTE:  This will consume the memory pointed to by dent, it seems. */
-       remove_proc_entry(VLAN_DEV_INFO(vlandev)->dent->name, proc_vlan_dir);
-       VLAN_DEV_INFO(vlandev)->dent = NULL;
+       if (VLAN_DEV_INFO(vlandev)->dent) {
+               remove_proc_entry(VLAN_DEV_INFO(vlandev)->dent->name, proc_vlan_dir);
+               VLAN_DEV_INFO(vlandev)->dent = NULL;
+       }
 
        return 0;
 }