File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -151,7 +151,7 @@ extern int sysctl_aarp_retransmit_limit;
151151extern int sysctl_aarp_resolve_time ;
152152
153153#ifdef CONFIG_SYSCTL
154- extern void atalk_register_sysctl (void );
154+ extern int atalk_register_sysctl (void );
155155extern void atalk_unregister_sysctl (void );
156156#else
157157#define atalk_register_sysctl () do { } while(0)
Original file line number Diff line number Diff line change @@ -293,7 +293,7 @@ int __init atalk_proc_init(void)
293293 goto out ;
294294}
295295
296- void __exit atalk_proc_exit (void )
296+ void atalk_proc_exit (void )
297297{
298298 remove_proc_entry ("interface" , atalk_proc_dir );
299299 remove_proc_entry ("route" , atalk_proc_dir );
Original file line number Diff line number Diff line change @@ -1912,25 +1912,50 @@ static const char atalk_err_snap[] __initconst =
19121912/* Called by proto.c on kernel start up */
19131913static int __init atalk_init (void )
19141914{
1915- int rc = proto_register ( & ddp_proto , 0 ) ;
1915+ int rc ;
19161916
1917- if (rc != 0 )
1917+ rc = proto_register (& ddp_proto , 0 );
1918+ if (rc )
19181919 goto out ;
19191920
1920- (void )sock_register (& atalk_family_ops );
1921+ rc = sock_register (& atalk_family_ops );
1922+ if (rc )
1923+ goto out_proto ;
1924+
19211925 ddp_dl = register_snap_client (ddp_snap_id , atalk_rcv );
19221926 if (!ddp_dl )
19231927 printk (atalk_err_snap );
19241928
19251929 dev_add_pack (& ltalk_packet_type );
19261930 dev_add_pack (& ppptalk_packet_type );
19271931
1928- register_netdevice_notifier (& ddp_notifier );
1932+ rc = register_netdevice_notifier (& ddp_notifier );
1933+ if (rc )
1934+ goto out_sock ;
1935+
19291936 aarp_proto_init ();
1930- atalk_proc_init ();
1931- atalk_register_sysctl ();
1937+ rc = atalk_proc_init ();
1938+ if (rc )
1939+ goto out_aarp ;
1940+
1941+ rc = atalk_register_sysctl ();
1942+ if (rc )
1943+ goto out_proc ;
19321944out :
19331945 return rc ;
1946+ out_proc :
1947+ atalk_proc_exit ();
1948+ out_aarp :
1949+ aarp_cleanup_module ();
1950+ unregister_netdevice_notifier (& ddp_notifier );
1951+ out_sock :
1952+ dev_remove_pack (& ppptalk_packet_type );
1953+ dev_remove_pack (& ltalk_packet_type );
1954+ unregister_snap_client (ddp_dl );
1955+ sock_unregister (PF_APPLETALK );
1956+ out_proto :
1957+ proto_unregister (& ddp_proto );
1958+ goto out ;
19341959}
19351960module_init (atalk_init );
19361961
Original file line number Diff line number Diff line change @@ -45,9 +45,12 @@ static struct ctl_table atalk_table[] = {
4545
4646static struct ctl_table_header * atalk_table_header ;
4747
48- void atalk_register_sysctl (void )
48+ int __init atalk_register_sysctl (void )
4949{
5050 atalk_table_header = register_net_sysctl (& init_net , "net/appletalk" , atalk_table );
51+ if (!atalk_table_header )
52+ return - ENOMEM ;
53+ return 0 ;
5154}
5255
5356void atalk_unregister_sysctl (void )
You can’t perform that action at this time.
0 commit comments