diff options
author | Wang Chen <wangchen@cn.fujitsu.com> | 2008-03-24 00:45:36 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-03-24 00:45:36 -0400 |
commit | dbee0d3f4603b9d0e56234a0743321fe4dad31ca (patch) | |
tree | d13b829d46ae603b8e7772ecae72e9be1fdfb7af /net | |
parent | da990a2402aeaee84837f29054c4628eb02f7493 (diff) |
[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')
-rw-r--r-- | net/atm/clip.c | 19 | ||||
-rw-r--r-- | net/atm/lec.c | 4 |
2 files changed, 20 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 = { | |||
947 | }; | 947 | }; |
948 | #endif | 948 | #endif |
949 | 949 | ||
950 | static void atm_clip_exit_noproc(void); | ||
951 | |||
950 | static int __init atm_clip_init(void) | 952 | static int __init atm_clip_init(void) |
951 | { | 953 | { |
952 | neigh_table_init_no_netlink(&clip_tbl); | 954 | neigh_table_init_no_netlink(&clip_tbl); |
@@ -963,18 +965,22 @@ static int __init atm_clip_init(void) | |||
963 | struct proc_dir_entry *p; | 965 | struct proc_dir_entry *p; |
964 | 966 | ||
965 | p = proc_create("arp", S_IRUGO, atm_proc_root, &arp_seq_fops); | 967 | p = proc_create("arp", S_IRUGO, atm_proc_root, &arp_seq_fops); |
968 | if (!p) { | ||
969 | printk(KERN_ERR "Unable to initialize " | ||
970 | "/proc/net/atm/arp\n"); | ||
971 | atm_clip_exit_noproc(); | ||
972 | return -ENOMEM; | ||
973 | } | ||
966 | } | 974 | } |
967 | #endif | 975 | #endif |
968 | 976 | ||
969 | return 0; | 977 | return 0; |
970 | } | 978 | } |
971 | 979 | ||
972 | static void __exit atm_clip_exit(void) | 980 | static void atm_clip_exit_noproc(void) |
973 | { | 981 | { |
974 | struct net_device *dev, *next; | 982 | struct net_device *dev, *next; |
975 | 983 | ||
976 | remove_proc_entry("arp", atm_proc_root); | ||
977 | |||
978 | unregister_inetaddr_notifier(&clip_inet_notifier); | 984 | unregister_inetaddr_notifier(&clip_inet_notifier); |
979 | unregister_netdevice_notifier(&clip_dev_notifier); | 985 | unregister_netdevice_notifier(&clip_dev_notifier); |
980 | 986 | ||
@@ -1005,6 +1011,13 @@ static void __exit atm_clip_exit(void) | |||
1005 | clip_tbl_hook = NULL; | 1011 | clip_tbl_hook = NULL; |
1006 | } | 1012 | } |
1007 | 1013 | ||
1014 | static void __exit atm_clip_exit(void) | ||
1015 | { | ||
1016 | remove_proc_entry("arp", atm_proc_root); | ||
1017 | |||
1018 | atm_clip_exit_noproc(); | ||
1019 | } | ||
1020 | |||
1008 | module_init(atm_clip_init); | 1021 | module_init(atm_clip_init); |
1009 | module_exit(atm_clip_exit); | 1022 | module_exit(atm_clip_exit); |
1010 | MODULE_AUTHOR("Werner Almesberger"); | 1023 | MODULE_AUTHOR("Werner Almesberger"); |
diff --git a/net/atm/lec.c b/net/atm/lec.c index 0e450d12f035..a2efa7ff41f1 100644 --- a/net/atm/lec.c +++ b/net/atm/lec.c | |||
@@ -1250,6 +1250,10 @@ static int __init lane_module_init(void) | |||
1250 | struct proc_dir_entry *p; | 1250 | struct proc_dir_entry *p; |
1251 | 1251 | ||
1252 | p = proc_create("lec", S_IRUGO, atm_proc_root, &lec_seq_fops); | 1252 | p = proc_create("lec", S_IRUGO, atm_proc_root, &lec_seq_fops); |
1253 | if (!p) { | ||
1254 | printk(KERN_ERR "Unable to initialize /proc/net/atm/lec\n"); | ||
1255 | return -ENOMEM; | ||
1256 | } | ||
1253 | #endif | 1257 | #endif |
1254 | 1258 | ||
1255 | register_atm_ioctl(&lane_ioctl_ops); | 1259 | register_atm_ioctl(&lane_ioctl_ops); |