sctp: Correctly cleanup procfs entries upon failure.
authorWei Yongjun <yjwei@cn.fujitsu.com>
Mon, 16 Jun 2008 23:59:55 +0000 (16:59 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 16 Jun 2008 23:59:55 +0000 (16:59 -0700)
This patch remove the proc fs entry which has been created if fail to
set up proc fs entry for the SCTP protocol.

Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sctp/protocol.c

index b435a193c5df916cd8d4ff7d0412167d17f5c99d..9258dfe784aee759e71c68115fa4eb847d6b8825 100644 (file)
@@ -108,14 +108,23 @@ static __init int sctp_proc_init(void)
        }
 
        if (sctp_snmp_proc_init())
-               goto out_nomem;
+               goto out_snmp_proc_init;
        if (sctp_eps_proc_init())
-               goto out_nomem;
+               goto out_eps_proc_init;
        if (sctp_assocs_proc_init())
-               goto out_nomem;
+               goto out_assocs_proc_init;
 
        return 0;
 
+out_assocs_proc_init:
+       sctp_eps_proc_exit();
+out_eps_proc_init:
+       sctp_snmp_proc_exit();
+out_snmp_proc_init:
+       if (proc_net_sctp) {
+               proc_net_sctp = NULL;
+               remove_proc_entry("sctp", init_net.proc_net);
+       }
 out_nomem:
        return -ENOMEM;
 }