File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -158,7 +158,7 @@ extern int sysctl_aarp_retransmit_limit;
158158extern int sysctl_aarp_resolve_time ;
159159
160160#ifdef CONFIG_SYSCTL
161- extern void atalk_register_sysctl (void );
161+ extern int atalk_register_sysctl (void );
162162extern void atalk_unregister_sysctl (void );
163163#else
164164#define atalk_register_sysctl () do { } while(0)
Original file line number Diff line number Diff line change @@ -237,7 +237,7 @@ int __init atalk_proc_init(void)
237237 return - ENOMEM ;
238238}
239239
240- void __exit atalk_proc_exit (void )
240+ void atalk_proc_exit (void )
241241{
242242 remove_proc_subtree ("atalk" , init_net .proc_net );
243243}
Original file line number Diff line number Diff line change @@ -1910,25 +1910,50 @@ static const char atalk_err_snap[] __initconst =
19101910/* Called by proto.c on kernel start up */
19111911static int __init atalk_init (void )
19121912{
1913- int rc = proto_register ( & ddp_proto , 0 ) ;
1913+ int rc ;
19141914
1915- if (rc != 0 )
1915+ rc = proto_register (& ddp_proto , 0 );
1916+ if (rc )
19161917 goto out ;
19171918
1918- (void )sock_register (& atalk_family_ops );
1919+ rc = sock_register (& atalk_family_ops );
1920+ if (rc )
1921+ goto out_proto ;
1922+
19191923 ddp_dl = register_snap_client (ddp_snap_id , atalk_rcv );
19201924 if (!ddp_dl )
19211925 printk (atalk_err_snap );
19221926
19231927 dev_add_pack (& ltalk_packet_type );
19241928 dev_add_pack (& ppptalk_packet_type );
19251929
1926- register_netdevice_notifier (& ddp_notifier );
1930+ rc = register_netdevice_notifier (& ddp_notifier );
1931+ if (rc )
1932+ goto out_sock ;
1933+
19271934 aarp_proto_init ();
1928- atalk_proc_init ();
1929- atalk_register_sysctl ();
1935+ rc = atalk_proc_init ();
1936+ if (rc )
1937+ goto out_aarp ;
1938+
1939+ rc = atalk_register_sysctl ();
1940+ if (rc )
1941+ goto out_proc ;
19301942out :
19311943 return rc ;
1944+ out_proc :
1945+ atalk_proc_exit ();
1946+ out_aarp :
1947+ aarp_cleanup_module ();
1948+ unregister_netdevice_notifier (& ddp_notifier );
1949+ out_sock :
1950+ dev_remove_pack (& ppptalk_packet_type );
1951+ dev_remove_pack (& ltalk_packet_type );
1952+ unregister_snap_client (ddp_dl );
1953+ sock_unregister (PF_APPLETALK );
1954+ out_proto :
1955+ proto_unregister (& ddp_proto );
1956+ goto out ;
19321957}
19331958module_init (atalk_init );
19341959
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