Commit dbee0d3f authored by Wang Chen's avatar Wang Chen Committed by David S. Miller

[ATM]: When proc_create() fails, do some error handling work and return -ENOMEM.

Signed-off-by: default avatarWang Chen <wangchen@cn.fujitsu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent da990a24
...@@ -947,6 +947,8 @@ static const struct file_operations arp_seq_fops = { ...@@ -947,6 +947,8 @@ static const struct file_operations arp_seq_fops = {
}; };
#endif #endif
static void atm_clip_exit_noproc(void);
static int __init atm_clip_init(void) static int __init atm_clip_init(void)
{ {
neigh_table_init_no_netlink(&clip_tbl); neigh_table_init_no_netlink(&clip_tbl);
...@@ -963,18 +965,22 @@ static int __init atm_clip_init(void) ...@@ -963,18 +965,22 @@ static int __init atm_clip_init(void)
struct proc_dir_entry *p; struct proc_dir_entry *p;
p = proc_create("arp", S_IRUGO, atm_proc_root, &arp_seq_fops); p = proc_create("arp", S_IRUGO, atm_proc_root, &arp_seq_fops);
if (!p) {
printk(KERN_ERR "Unable to initialize "
"/proc/net/atm/arp\n");
atm_clip_exit_noproc();
return -ENOMEM;
}
} }
#endif #endif
return 0; return 0;
} }
static void __exit atm_clip_exit(void) static void atm_clip_exit_noproc(void)
{ {
struct net_device *dev, *next; struct net_device *dev, *next;
remove_proc_entry("arp", atm_proc_root);
unregister_inetaddr_notifier(&clip_inet_notifier); unregister_inetaddr_notifier(&clip_inet_notifier);
unregister_netdevice_notifier(&clip_dev_notifier); unregister_netdevice_notifier(&clip_dev_notifier);
...@@ -1005,6 +1011,13 @@ static void __exit atm_clip_exit(void) ...@@ -1005,6 +1011,13 @@ static void __exit atm_clip_exit(void)
clip_tbl_hook = NULL; clip_tbl_hook = NULL;
} }
static void __exit atm_clip_exit(void)
{
remove_proc_entry("arp", atm_proc_root);
atm_clip_exit_noproc();
}
module_init(atm_clip_init); module_init(atm_clip_init);
module_exit(atm_clip_exit); module_exit(atm_clip_exit);
MODULE_AUTHOR("Werner Almesberger"); MODULE_AUTHOR("Werner Almesberger");
......
...@@ -1250,6 +1250,10 @@ static int __init lane_module_init(void) ...@@ -1250,6 +1250,10 @@ static int __init lane_module_init(void)
struct proc_dir_entry *p; struct proc_dir_entry *p;
p = proc_create("lec", S_IRUGO, atm_proc_root, &lec_seq_fops); p = proc_create("lec", S_IRUGO, atm_proc_root, &lec_seq_fops);
if (!p) {
printk(KERN_ERR "Unable to initialize /proc/net/atm/lec\n");
return -ENOMEM;
}
#endif #endif
register_atm_ioctl(&lane_ioctl_ops); register_atm_ioctl(&lane_ioctl_ops);
......
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