Commit 4a9b943d authored by Eran Mann's avatar Eran Mann Committed by David S. Miller

[VLAN]: Fix OOPS on module removal.

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...
parent a61e73fd
......@@ -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);
......
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment