summaryrefslogtreecommitdiffstats
path: root/net/atm/clip.c
diff options
context:
space:
mode:
authorWang Chen <wangchen@cn.fujitsu.com>2008-03-24 05:45:36 +0100
committerDavid S. Miller <davem@davemloft.net>2008-03-24 05:45:36 +0100
commitdbee0d3f4603b9d0e56234a0743321fe4dad31ca (patch)
treed13b829d46ae603b8e7772ecae72e9be1fdfb7af /net/atm/clip.c
parent[SUNGEM]: Fix NAPI assertion failure. (diff)
downloadlinux-dbee0d3f4603b9d0e56234a0743321fe4dad31ca.tar.xz
linux-dbee0d3f4603b9d0e56234a0743321fe4dad31ca.zip
[ATM]: When proc_create() fails, do some error handling work and return -ENOMEM.
Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/atm/clip.c')
-rw-r--r--net/atm/clip.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/net/atm/clip.c b/net/atm/clip.c
index d30167c0b48e..2ab1e36098fd 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -947,6 +947,8 @@ static const struct file_operations arp_seq_fops = {
};
#endif
+static void atm_clip_exit_noproc(void);
+
static int __init atm_clip_init(void)
{
neigh_table_init_no_netlink(&clip_tbl);
@@ -963,18 +965,22 @@ static int __init atm_clip_init(void)
struct proc_dir_entry *p;
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
return 0;
}
-static void __exit atm_clip_exit(void)
+static void atm_clip_exit_noproc(void)
{
struct net_device *dev, *next;
- remove_proc_entry("arp", atm_proc_root);
-
unregister_inetaddr_notifier(&clip_inet_notifier);
unregister_netdevice_notifier(&clip_dev_notifier);
@@ -1005,6 +1011,13 @@ static void __exit atm_clip_exit(void)
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_exit(atm_clip_exit);
MODULE_AUTHOR("Werner Almesberger");