Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Wang Chen and committed by
David S. Miller
dbee0d3f da990a24

+20 -3
+16 -3
net/atm/clip.c
··· 947 947 }; 948 948 #endif 949 949 950 + static void atm_clip_exit_noproc(void); 951 + 950 952 static int __init atm_clip_init(void) 951 953 { 952 954 neigh_table_init_no_netlink(&clip_tbl); ··· 965 963 struct proc_dir_entry *p; 966 964 967 965 p = proc_create("arp", S_IRUGO, atm_proc_root, &arp_seq_fops); 966 + if (!p) { 967 + printk(KERN_ERR "Unable to initialize " 968 + "/proc/net/atm/arp\n"); 969 + atm_clip_exit_noproc(); 970 + return -ENOMEM; 971 + } 968 972 } 969 973 #endif 970 974 971 975 return 0; 972 976 } 973 977 974 - static void __exit atm_clip_exit(void) 978 + static void atm_clip_exit_noproc(void) 975 979 { 976 980 struct net_device *dev, *next; 977 - 978 - remove_proc_entry("arp", atm_proc_root); 979 981 980 982 unregister_inetaddr_notifier(&clip_inet_notifier); 981 983 unregister_netdevice_notifier(&clip_dev_notifier); ··· 1009 1003 neigh_table_clear(&clip_tbl); 1010 1004 1011 1005 clip_tbl_hook = NULL; 1006 + } 1007 + 1008 + static void __exit atm_clip_exit(void) 1009 + { 1010 + remove_proc_entry("arp", atm_proc_root); 1011 + 1012 + atm_clip_exit_noproc(); 1012 1013 } 1013 1014 1014 1015 module_init(atm_clip_init);
+4
net/atm/lec.c
··· 1250 1250 struct proc_dir_entry *p; 1251 1251 1252 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 1257 #endif 1254 1258 1255 1259 register_atm_ioctl(&lane_ioctl_ops);