diff options
| author | Eran Mann <emann@mrv.com> | 2003-08-19 21:35:59 -0700 |
|---|---|---|
| committer | David S. Miller <davem@kernel.bkbits.net> | 2003-08-19 21:35:59 -0700 |
| commit | 4a9b943db511376d7bbecb7a0eaa57aaef77611e (patch) | |
| tree | 2ab611eeadf0d375a0d500482a317abd66c1c1a8 | |
| parent | a61e73fd586f032efe11a99c0a195fefa53fb2d6 (diff) | |
[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...
| -rw-r--r-- | net/8021q/vlan.c | 4 | ||||
| -rw-r--r-- | net/8021q/vlanproc.c | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 03f7077524f5..7efda3575e40 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c @@ -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); diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c index 58233aa087aa..e4cf6c0757df 100644 --- a/net/8021q/vlanproc.c +++ b/net/8021q/vlanproc.c @@ -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; } |
