aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-03-21 06:42:24 -0400
committerDavid S. Miller <davem@davemloft.net>2008-03-21 06:42:24 -0400
commita25606c845856e5ca5ed54d23cab077e3a49bf10 (patch)
tree1721e46532d6f48d605d401d7cee83f78f551c45
parent938b93adb2642885e688390396472d22a7548748 (diff)
parent94833dfb8c98ed4ca1944dd2c1339d88a2d1c758 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
-rw-r--r--MAINTAINERS2
-rw-r--r--drivers/net/ifb.c15
-rw-r--r--drivers/net/tg3.c6
-rw-r--r--fs/proc/base.c2
-rw-r--r--include/net/sctp/sctp.h12
-rw-r--r--kernel/audit.c11
-rw-r--r--net/bridge/br_fdb.c2
-rw-r--r--net/core/netpoll.c6
-rw-r--r--net/ipv4/netfilter/ipt_recent.c2
-rw-r--r--net/ipv4/tcp_output.c2
-rw-r--r--net/ipv6/Kconfig5
-rw-r--r--net/netfilter/nf_conntrack_h323_main.c2
-rw-r--r--net/sctp/ipv6.c32
-rw-r--r--net/sctp/protocol.c129
14 files changed, 152 insertions, 76 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index c13408ccaf9c..27a17069106f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -871,7 +871,7 @@ P: Marcel Holtmann
871M: marcel@holtmann.org 871M: marcel@holtmann.org
872P: Maxim Krasnyansky 872P: Maxim Krasnyansky
873M: maxk@qualcomm.com 873M: maxk@qualcomm.com
874L: bluez-devel@lists.sf.net 874L: linux-bluetooth@vger.kernel.org
875W: http://bluez.sf.net 875W: http://bluez.sf.net
876W: http://www.bluez.org 876W: http://www.bluez.org
877W: http://www.holtmann.org/linux/bluetooth/ 877W: http://www.holtmann.org/linux/bluetooth/
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
index 15949d3df17e..af233b591534 100644
--- a/drivers/net/ifb.c
+++ b/drivers/net/ifb.c
@@ -35,6 +35,7 @@
35#include <linux/moduleparam.h> 35#include <linux/moduleparam.h>
36#include <net/pkt_sched.h> 36#include <net/pkt_sched.h>
37#include <net/net_namespace.h> 37#include <net/net_namespace.h>
38#include <linux/lockdep.h>
38 39
39#define TX_TIMEOUT (2*HZ) 40#define TX_TIMEOUT (2*HZ)
40 41
@@ -227,6 +228,16 @@ static struct rtnl_link_ops ifb_link_ops __read_mostly = {
227module_param(numifbs, int, 0); 228module_param(numifbs, int, 0);
228MODULE_PARM_DESC(numifbs, "Number of ifb devices"); 229MODULE_PARM_DESC(numifbs, "Number of ifb devices");
229 230
231/*
232 * dev_ifb->queue_lock is usually taken after dev->ingress_lock,
233 * reversely to e.g. qdisc_lock_tree(). It should be safe until
234 * ifb doesn't take dev->queue_lock with dev_ifb->ingress_lock.
235 * But lockdep should know that ifb has different locks from dev.
236 */
237static struct lock_class_key ifb_queue_lock_key;
238static struct lock_class_key ifb_ingress_lock_key;
239
240
230static int __init ifb_init_one(int index) 241static int __init ifb_init_one(int index)
231{ 242{
232 struct net_device *dev_ifb; 243 struct net_device *dev_ifb;
@@ -246,6 +257,10 @@ static int __init ifb_init_one(int index)
246 err = register_netdevice(dev_ifb); 257 err = register_netdevice(dev_ifb);
247 if (err < 0) 258 if (err < 0)
248 goto err; 259 goto err;
260
261 lockdep_set_class(&dev_ifb->queue_lock, &ifb_queue_lock_key);
262 lockdep_set_class(&dev_ifb->ingress_lock, &ifb_ingress_lock_key);
263
249 return 0; 264 return 0;
250 265
251err: 266err:
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 26ffb67f1da2..f9ef8bd8b11e 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -64,8 +64,8 @@
64 64
65#define DRV_MODULE_NAME "tg3" 65#define DRV_MODULE_NAME "tg3"
66#define PFX DRV_MODULE_NAME ": " 66#define PFX DRV_MODULE_NAME ": "
67#define DRV_MODULE_VERSION "3.87" 67#define DRV_MODULE_VERSION "3.88"
68#define DRV_MODULE_RELDATE "December 20, 2007" 68#define DRV_MODULE_RELDATE "March 20, 2008"
69 69
70#define TG3_DEF_MAC_MODE 0 70#define TG3_DEF_MAC_MODE 0
71#define TG3_DEF_RX_MODE 0 71#define TG3_DEF_RX_MODE 0
@@ -11841,7 +11841,7 @@ static int __devinit tg3_get_device_address(struct tg3 *tp)
11841 } 11841 }
11842 11842
11843 if (!is_valid_ether_addr(&dev->dev_addr[0])) { 11843 if (!is_valid_ether_addr(&dev->dev_addr[0])) {
11844#ifdef CONFIG_SPARC64 11844#ifdef CONFIG_SPARC
11845 if (!tg3_get_default_macaddr_sparc(tp)) 11845 if (!tg3_get_default_macaddr_sparc(tp))
11846 return 0; 11846 return 0;
11847#endif 11847#endif
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 9a4da0aae02e..770de444eba0 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2270,7 +2270,7 @@ static const struct pid_entry tgid_base_stuff[] = {
2270 DIR("fd", S_IRUSR|S_IXUSR, fd), 2270 DIR("fd", S_IRUSR|S_IXUSR, fd),
2271 DIR("fdinfo", S_IRUSR|S_IXUSR, fdinfo), 2271 DIR("fdinfo", S_IRUSR|S_IXUSR, fdinfo),
2272#ifdef CONFIG_NET 2272#ifdef CONFIG_NET
2273 DIR("net", S_IRUGO|S_IXUSR, net), 2273 DIR("net", S_IRUGO|S_IXUGO, net),
2274#endif 2274#endif
2275 REG("environ", S_IRUSR, environ), 2275 REG("environ", S_IRUSR, environ),
2276 INF("auxv", S_IRUSR, pid_auxv), 2276 INF("auxv", S_IRUSR, pid_auxv),
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index a653eb3e1e70..dbfde62f3608 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -375,15 +375,19 @@ static inline void sctp_sysctl_unregister(void) { return; }
375 375
376#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 376#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
377 377
378int sctp_v6_init(void); 378void sctp_v6_pf_init(void);
379void sctp_v6_exit(void); 379void sctp_v6_pf_exit(void);
380int sctp_v6_protosw_init(void);
381void sctp_v6_protosw_exit(void);
380int sctp_v6_add_protocol(void); 382int sctp_v6_add_protocol(void);
381void sctp_v6_del_protocol(void); 383void sctp_v6_del_protocol(void);
382 384
383#else /* #ifdef defined(CONFIG_IPV6) */ 385#else /* #ifdef defined(CONFIG_IPV6) */
384 386
385static inline int sctp_v6_init(void) { return 0; } 387static inline void sctp_v6_pf_init(void) { return 0; }
386static inline void sctp_v6_exit(void) { return; } 388static inline void sctp_v6_pf_exit(void) { return; }
389static inline int sctp_v6_protosw_init(void) { return 0; }
390static inline void sctp_v6_protosw_exit(void) { return; }
387static inline int sctp_v6_add_protocol(void) { return 0; } 391static inline int sctp_v6_add_protocol(void) { return 0; }
388static inline void sctp_v6_del_protocol(void) { return; } 392static inline void sctp_v6_del_protocol(void) { return; }
389 393
diff --git a/kernel/audit.c b/kernel/audit.c
index 10c4930c2bbf..be55cb503633 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -78,9 +78,13 @@ static int audit_default;
78/* If auditing cannot proceed, audit_failure selects what happens. */ 78/* If auditing cannot proceed, audit_failure selects what happens. */
79static int audit_failure = AUDIT_FAIL_PRINTK; 79static int audit_failure = AUDIT_FAIL_PRINTK;
80 80
81/* If audit records are to be written to the netlink socket, audit_pid 81/*
82 * contains the (non-zero) pid. */ 82 * If audit records are to be written to the netlink socket, audit_pid
83 * contains the pid of the auditd process and audit_nlk_pid contains
84 * the pid to use to send netlink messages to that process.
85 */
83int audit_pid; 86int audit_pid;
87static int audit_nlk_pid;
84 88
85/* If audit_rate_limit is non-zero, limit the rate of sending audit records 89/* If audit_rate_limit is non-zero, limit the rate of sending audit records
86 * to that number per second. This prevents DoS attacks, but results in 90 * to that number per second. This prevents DoS attacks, but results in
@@ -350,7 +354,7 @@ static int kauditd_thread(void *dummy)
350 wake_up(&audit_backlog_wait); 354 wake_up(&audit_backlog_wait);
351 if (skb) { 355 if (skb) {
352 if (audit_pid) { 356 if (audit_pid) {
353 int err = netlink_unicast(audit_sock, skb, audit_pid, 0); 357 int err = netlink_unicast(audit_sock, skb, audit_nlk_pid, 0);
354 if (err < 0) { 358 if (err < 0) {
355 BUG_ON(err != -ECONNREFUSED); /* Shoudn't happen */ 359 BUG_ON(err != -ECONNREFUSED); /* Shoudn't happen */
356 printk(KERN_ERR "audit: *NO* daemon at audit_pid=%d\n", audit_pid); 360 printk(KERN_ERR "audit: *NO* daemon at audit_pid=%d\n", audit_pid);
@@ -626,6 +630,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
626 sid, 1); 630 sid, 1);
627 631
628 audit_pid = new_pid; 632 audit_pid = new_pid;
633 audit_nlk_pid = NETLINK_CB(skb).pid;
629 } 634 }
630 if (status_get->mask & AUDIT_STATUS_RATE_LIMIT) 635 if (status_get->mask & AUDIT_STATUS_RATE_LIMIT)
631 err = audit_set_rate_limit(status_get->rate_limit, 636 err = audit_set_rate_limit(status_get->rate_limit,
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index bc40377136a2..9326c377822e 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -136,7 +136,7 @@ void br_fdb_cleanup(unsigned long _data)
136 this_timer = f->ageing_timer + delay; 136 this_timer = f->ageing_timer + delay;
137 if (time_before_eq(this_timer, jiffies)) 137 if (time_before_eq(this_timer, jiffies))
138 fdb_delete(f); 138 fdb_delete(f);
139 else if (this_timer < next_timer) 139 else if (time_before(this_timer, next_timer))
140 next_timer = this_timer; 140 next_timer = this_timer;
141 } 141 }
142 } 142 }
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index d0c8bf585f06..b04d643fc3c7 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -215,10 +215,12 @@ static void zap_completion_queue(void)
215 while (clist != NULL) { 215 while (clist != NULL) {
216 struct sk_buff *skb = clist; 216 struct sk_buff *skb = clist;
217 clist = clist->next; 217 clist = clist->next;
218 if (skb->destructor) 218 if (skb->destructor) {
219 atomic_inc(&skb->users);
219 dev_kfree_skb_any(skb); /* put this one back */ 220 dev_kfree_skb_any(skb); /* put this one back */
220 else 221 } else {
221 __kfree_skb(skb); 222 __kfree_skb(skb);
223 }
222 } 224 }
223 } 225 }
224 226
diff --git a/net/ipv4/netfilter/ipt_recent.c b/net/ipv4/netfilter/ipt_recent.c
index 68cbe3ca01ce..8e8f0425a8ed 100644
--- a/net/ipv4/netfilter/ipt_recent.c
+++ b/net/ipv4/netfilter/ipt_recent.c
@@ -252,6 +252,8 @@ recent_mt_check(const char *tablename, const void *ip,
252 if ((info->check_set & (IPT_RECENT_SET | IPT_RECENT_REMOVE)) && 252 if ((info->check_set & (IPT_RECENT_SET | IPT_RECENT_REMOVE)) &&
253 (info->seconds || info->hit_count)) 253 (info->seconds || info->hit_count))
254 return false; 254 return false;
255 if (info->hit_count > ip_pkt_list_tot)
256 return false;
255 if (info->name[0] == '\0' || 257 if (info->name[0] == '\0' ||
256 strnlen(info->name, IPT_RECENT_NAME_LEN) == IPT_RECENT_NAME_LEN) 258 strnlen(info->name, IPT_RECENT_NAME_LEN) == IPT_RECENT_NAME_LEN)
257 return false; 259 return false;
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 67f84f5035c4..b4e11d834c9f 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -255,7 +255,7 @@ static u16 tcp_select_window(struct sock *sk)
255 * 255 *
256 * Relax Will Robinson. 256 * Relax Will Robinson.
257 */ 257 */
258 new_win = cur_win; 258 new_win = ALIGN(cur_win, 1 << tp->rx_opt.rcv_wscale);
259 } 259 }
260 tp->rcv_wnd = new_win; 260 tp->rcv_wnd = new_win;
261 tp->rcv_wup = tp->rcv_nxt; 261 tp->rcv_wup = tp->rcv_nxt;
diff --git a/net/ipv6/Kconfig b/net/ipv6/Kconfig
index 58219dfffef8..47263e45bacb 100644
--- a/net/ipv6/Kconfig
+++ b/net/ipv6/Kconfig
@@ -179,11 +179,12 @@ config IPV6_SIT
179 Saying M here will produce a module called sit.ko. If unsure, say Y. 179 Saying M here will produce a module called sit.ko. If unsure, say Y.
180 180
181config IPV6_TUNNEL 181config IPV6_TUNNEL
182 tristate "IPv6: IPv6-in-IPv6 tunnel" 182 tristate "IPv6: IP-in-IPv6 tunnel (RFC2473)"
183 select INET6_TUNNEL 183 select INET6_TUNNEL
184 depends on IPV6 184 depends on IPV6
185 ---help--- 185 ---help---
186 Support for IPv6-in-IPv6 tunnels described in RFC 2473. 186 Support for IPv6-in-IPv6 and IPv4-in-IPv6 tunnels described in
187 RFC 2473.
187 188
188 If unsure, say N. 189 If unsure, say N.
189 190
diff --git a/net/netfilter/nf_conntrack_h323_main.c b/net/netfilter/nf_conntrack_h323_main.c
index 62137879e6aa..898f1922b5b8 100644
--- a/net/netfilter/nf_conntrack_h323_main.c
+++ b/net/netfilter/nf_conntrack_h323_main.c
@@ -842,7 +842,7 @@ static int process_setup(struct sk_buff *skb, struct nf_conn *ct,
842 842
843 set_h225_addr = rcu_dereference(set_h225_addr_hook); 843 set_h225_addr = rcu_dereference(set_h225_addr_hook);
844 if ((setup->options & eSetup_UUIE_destCallSignalAddress) && 844 if ((setup->options & eSetup_UUIE_destCallSignalAddress) &&
845 (set_h225_addr) && ct->status && IPS_NAT_MASK && 845 (set_h225_addr) && ct->status & IPS_NAT_MASK &&
846 get_h225_addr(ct, *data, &setup->destCallSignalAddress, 846 get_h225_addr(ct, *data, &setup->destCallSignalAddress,
847 &addr, &port) && 847 &addr, &port) &&
848 memcmp(&addr, &ct->tuplehash[!dir].tuple.src.u3, sizeof(addr))) { 848 memcmp(&addr, &ct->tuplehash[!dir].tuple.src.u3, sizeof(addr))) {
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 1937be583cd7..46c5b3c5cb99 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -1015,15 +1015,24 @@ static struct sctp_pf sctp_pf_inet6 = {
1015}; 1015};
1016 1016
1017/* Initialize IPv6 support and register with socket layer. */ 1017/* Initialize IPv6 support and register with socket layer. */
1018int sctp_v6_init(void) 1018void sctp_v6_pf_init(void)
1019{ 1019{
1020 int rc;
1021
1022 /* Register the SCTP specific PF_INET6 functions. */ 1020 /* Register the SCTP specific PF_INET6 functions. */
1023 sctp_register_pf(&sctp_pf_inet6, PF_INET6); 1021 sctp_register_pf(&sctp_pf_inet6, PF_INET6);
1024 1022
1025 /* Register the SCTP specific AF_INET6 functions. */ 1023 /* Register the SCTP specific AF_INET6 functions. */
1026 sctp_register_af(&sctp_af_inet6); 1024 sctp_register_af(&sctp_af_inet6);
1025}
1026
1027void sctp_v6_pf_exit(void)
1028{
1029 list_del(&sctp_af_inet6.list);
1030}
1031
1032/* Initialize IPv6 support and register with socket layer. */
1033int sctp_v6_protosw_init(void)
1034{
1035 int rc;
1027 1036
1028 rc = proto_register(&sctpv6_prot, 1); 1037 rc = proto_register(&sctpv6_prot, 1);
1029 if (rc) 1038 if (rc)
@@ -1036,6 +1045,14 @@ int sctp_v6_init(void)
1036 return 0; 1045 return 0;
1037} 1046}
1038 1047
1048void sctp_v6_protosw_exit(void)
1049{
1050 inet6_unregister_protosw(&sctpv6_seqpacket_protosw);
1051 inet6_unregister_protosw(&sctpv6_stream_protosw);
1052 proto_unregister(&sctpv6_prot);
1053}
1054
1055
1039/* Register with inet6 layer. */ 1056/* Register with inet6 layer. */
1040int sctp_v6_add_protocol(void) 1057int sctp_v6_add_protocol(void)
1041{ 1058{
@@ -1048,15 +1065,6 @@ int sctp_v6_add_protocol(void)
1048 return 0; 1065 return 0;
1049} 1066}
1050 1067
1051/* IPv6 specific exit support. */
1052void sctp_v6_exit(void)
1053{
1054 inet6_unregister_protosw(&sctpv6_seqpacket_protosw);
1055 inet6_unregister_protosw(&sctpv6_stream_protosw);
1056 proto_unregister(&sctpv6_prot);
1057 list_del(&sctp_af_inet6.list);
1058}
1059
1060/* Unregister with inet6 layer. */ 1068/* Unregister with inet6 layer. */
1061void sctp_v6_del_protocol(void) 1069void sctp_v6_del_protocol(void)
1062{ 1070{
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 25be8f04de6e..beea2fb18b15 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -995,6 +995,58 @@ static void cleanup_sctp_mibs(void)
995 free_percpu(sctp_statistics[1]); 995 free_percpu(sctp_statistics[1]);
996} 996}
997 997
998static void sctp_v4_pf_init(void)
999{
1000 /* Initialize the SCTP specific PF functions. */
1001 sctp_register_pf(&sctp_pf_inet, PF_INET);
1002 sctp_register_af(&sctp_af_inet);
1003}
1004
1005static void sctp_v4_pf_exit(void)
1006{
1007 list_del(&sctp_af_inet.list);
1008}
1009
1010static int sctp_v4_protosw_init(void)
1011{
1012 int rc;
1013
1014 rc = proto_register(&sctp_prot, 1);
1015 if (rc)
1016 return rc;
1017
1018 /* Register SCTP(UDP and TCP style) with socket layer. */
1019 inet_register_protosw(&sctp_seqpacket_protosw);
1020 inet_register_protosw(&sctp_stream_protosw);
1021
1022 return 0;
1023}
1024
1025static void sctp_v4_protosw_exit(void)
1026{
1027 inet_unregister_protosw(&sctp_stream_protosw);
1028 inet_unregister_protosw(&sctp_seqpacket_protosw);
1029 proto_unregister(&sctp_prot);
1030}
1031
1032static int sctp_v4_add_protocol(void)
1033{
1034 /* Register notifier for inet address additions/deletions. */
1035 register_inetaddr_notifier(&sctp_inetaddr_notifier);
1036
1037 /* Register SCTP with inet layer. */
1038 if (inet_add_protocol(&sctp_protocol, IPPROTO_SCTP) < 0)
1039 return -EAGAIN;
1040
1041 return 0;
1042}
1043
1044static void sctp_v4_del_protocol(void)
1045{
1046 inet_del_protocol(&sctp_protocol, IPPROTO_SCTP);
1047 unregister_inetaddr_notifier(&sctp_inetaddr_notifier);
1048}
1049
998/* Initialize the universe into something sensible. */ 1050/* Initialize the universe into something sensible. */
999SCTP_STATIC __init int sctp_init(void) 1051SCTP_STATIC __init int sctp_init(void)
1000{ 1052{
@@ -1038,8 +1090,6 @@ SCTP_STATIC __init int sctp_init(void)
1038 /* Initialize object count debugging. */ 1090 /* Initialize object count debugging. */
1039 sctp_dbg_objcnt_init(); 1091 sctp_dbg_objcnt_init();
1040 1092
1041 /* Initialize the SCTP specific PF functions. */
1042 sctp_register_pf(&sctp_pf_inet, PF_INET);
1043 /* 1093 /*
1044 * 14. Suggested SCTP Protocol Parameter Values 1094 * 14. Suggested SCTP Protocol Parameter Values
1045 */ 1095 */
@@ -1197,19 +1247,22 @@ SCTP_STATIC __init int sctp_init(void)
1197 sctp_sysctl_register(); 1247 sctp_sysctl_register();
1198 1248
1199 INIT_LIST_HEAD(&sctp_address_families); 1249 INIT_LIST_HEAD(&sctp_address_families);
1200 sctp_register_af(&sctp_af_inet); 1250 sctp_v4_pf_init();
1251 sctp_v6_pf_init();
1201 1252
1202 status = proto_register(&sctp_prot, 1); 1253 /* Initialize the local address list. */
1203 if (status) 1254 INIT_LIST_HEAD(&sctp_local_addr_list);
1204 goto err_proto_register; 1255 spin_lock_init(&sctp_local_addr_lock);
1256 sctp_get_local_addr_list();
1205 1257
1206 /* Register SCTP(UDP and TCP style) with socket layer. */ 1258 status = sctp_v4_protosw_init();
1207 inet_register_protosw(&sctp_seqpacket_protosw);
1208 inet_register_protosw(&sctp_stream_protosw);
1209 1259
1210 status = sctp_v6_init();
1211 if (status) 1260 if (status)
1212 goto err_v6_init; 1261 goto err_protosw_init;
1262
1263 status = sctp_v6_protosw_init();
1264 if (status)
1265 goto err_v6_protosw_init;
1213 1266
1214 /* Initialize the control inode/socket for handling OOTB packets. */ 1267 /* Initialize the control inode/socket for handling OOTB packets. */
1215 if ((status = sctp_ctl_sock_init())) { 1268 if ((status = sctp_ctl_sock_init())) {
@@ -1218,19 +1271,9 @@ SCTP_STATIC __init int sctp_init(void)
1218 goto err_ctl_sock_init; 1271 goto err_ctl_sock_init;
1219 } 1272 }
1220 1273
1221 /* Initialize the local address list. */ 1274 status = sctp_v4_add_protocol();
1222 INIT_LIST_HEAD(&sctp_local_addr_list); 1275 if (status)
1223 spin_lock_init(&sctp_local_addr_lock);
1224 sctp_get_local_addr_list();
1225
1226 /* Register notifier for inet address additions/deletions. */
1227 register_inetaddr_notifier(&sctp_inetaddr_notifier);
1228
1229 /* Register SCTP with inet layer. */
1230 if (inet_add_protocol(&sctp_protocol, IPPROTO_SCTP) < 0) {
1231 status = -EAGAIN;
1232 goto err_add_protocol; 1276 goto err_add_protocol;
1233 }
1234 1277
1235 /* Register SCTP with inet6 layer. */ 1278 /* Register SCTP with inet6 layer. */
1236 status = sctp_v6_add_protocol(); 1279 status = sctp_v6_add_protocol();
@@ -1241,18 +1284,18 @@ SCTP_STATIC __init int sctp_init(void)
1241out: 1284out:
1242 return status; 1285 return status;
1243err_v6_add_protocol: 1286err_v6_add_protocol:
1244 inet_del_protocol(&sctp_protocol, IPPROTO_SCTP); 1287 sctp_v6_del_protocol();
1245 unregister_inetaddr_notifier(&sctp_inetaddr_notifier);
1246err_add_protocol: 1288err_add_protocol:
1247 sctp_free_local_addr_list(); 1289 sctp_v4_del_protocol();
1248 sock_release(sctp_ctl_socket); 1290 sock_release(sctp_ctl_socket);
1249err_ctl_sock_init: 1291err_ctl_sock_init:
1250 sctp_v6_exit(); 1292 sctp_v6_protosw_exit();
1251err_v6_init: 1293err_v6_protosw_init:
1252 inet_unregister_protosw(&sctp_stream_protosw); 1294 sctp_v4_protosw_exit();
1253 inet_unregister_protosw(&sctp_seqpacket_protosw); 1295err_protosw_init:
1254 proto_unregister(&sctp_prot); 1296 sctp_free_local_addr_list();
1255err_proto_register: 1297 sctp_v4_pf_exit();
1298 sctp_v6_pf_exit();
1256 sctp_sysctl_unregister(); 1299 sctp_sysctl_unregister();
1257 list_del(&sctp_af_inet.list); 1300 list_del(&sctp_af_inet.list);
1258 free_pages((unsigned long)sctp_port_hashtable, 1301 free_pages((unsigned long)sctp_port_hashtable,
@@ -1285,23 +1328,21 @@ SCTP_STATIC __exit void sctp_exit(void)
1285 1328
1286 /* Unregister with inet6/inet layers. */ 1329 /* Unregister with inet6/inet layers. */
1287 sctp_v6_del_protocol(); 1330 sctp_v6_del_protocol();
1288 inet_del_protocol(&sctp_protocol, IPPROTO_SCTP); 1331 sctp_v4_del_protocol();
1289
1290 /* Unregister notifier for inet address additions/deletions. */
1291 unregister_inetaddr_notifier(&sctp_inetaddr_notifier);
1292
1293 /* Free the local address list. */
1294 sctp_free_local_addr_list();
1295 1332
1296 /* Free the control endpoint. */ 1333 /* Free the control endpoint. */
1297 sock_release(sctp_ctl_socket); 1334 sock_release(sctp_ctl_socket);
1298 1335
1299 /* Cleanup v6 initializations. */ 1336 /* Free protosw registrations */
1300 sctp_v6_exit(); 1337 sctp_v6_protosw_exit();
1338 sctp_v4_protosw_exit();
1339
1340 /* Free the local address list. */
1341 sctp_free_local_addr_list();
1301 1342
1302 /* Unregister with socket layer. */ 1343 /* Unregister with socket layer. */
1303 inet_unregister_protosw(&sctp_stream_protosw); 1344 sctp_v6_pf_exit();
1304 inet_unregister_protosw(&sctp_seqpacket_protosw); 1345 sctp_v4_pf_exit();
1305 1346
1306 sctp_sysctl_unregister(); 1347 sctp_sysctl_unregister();
1307 list_del(&sctp_af_inet.list); 1348 list_del(&sctp_af_inet.list);
@@ -1320,8 +1361,6 @@ SCTP_STATIC __exit void sctp_exit(void)
1320 1361
1321 kmem_cache_destroy(sctp_chunk_cachep); 1362 kmem_cache_destroy(sctp_chunk_cachep);
1322 kmem_cache_destroy(sctp_bucket_cachep); 1363 kmem_cache_destroy(sctp_bucket_cachep);
1323
1324 proto_unregister(&sctp_prot);
1325} 1364}
1326 1365
1327module_init(sctp_init); 1366module_init(sctp_init);