diff options
author | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-01-31 12:24:00 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-01-31 12:24:00 -0500 |
commit | 30716e07ef511ec7525c07eb1e8060ba8943c2a2 (patch) | |
tree | eb6a47cae63d3587fa773cc5a16781eaa2c7810b /net | |
parent | 03c79cc56e4497cbd09d74a73c1bd0d1d9a8a16c (diff) | |
parent | f56df2f4db6e4af87fb8e941cff69f4501a111df (diff) |
Merge branch 'linus'
Diffstat (limited to 'net')
30 files changed, 181 insertions, 152 deletions
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 29a8fa4d3728..f8c25d500155 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
@@ -585,6 +585,12 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_ | |||
585 | goto done; | 585 | goto done; |
586 | } | 586 | } |
587 | 587 | ||
588 | if (la->l2_psm > 0 && btohs(la->l2_psm) < 0x1001 && | ||
589 | !capable(CAP_NET_BIND_SERVICE)) { | ||
590 | err = -EACCES; | ||
591 | goto done; | ||
592 | } | ||
593 | |||
588 | write_lock_bh(&l2cap_sk_list.lock); | 594 | write_lock_bh(&l2cap_sk_list.lock); |
589 | 595 | ||
590 | if (la->l2_psm && __l2cap_get_sock_by_addr(la->l2_psm, &la->l2_bdaddr)) { | 596 | if (la->l2_psm && __l2cap_get_sock_by_addr(la->l2_psm, &la->l2_bdaddr)) { |
@@ -2150,8 +2156,8 @@ static ssize_t l2cap_sysfs_show(struct class *dev, char *buf) | |||
2150 | 2156 | ||
2151 | str += sprintf(str, "%s %s %d %d 0x%4.4x 0x%4.4x %d %d 0x%x\n", | 2157 | str += sprintf(str, "%s %s %d %d 0x%4.4x 0x%4.4x %d %d 0x%x\n", |
2152 | batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), | 2158 | batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), |
2153 | sk->sk_state, pi->psm, pi->scid, pi->dcid, pi->imtu, | 2159 | sk->sk_state, btohs(pi->psm), pi->scid, pi->dcid, |
2154 | pi->omtu, pi->link_mode); | 2160 | pi->imtu, pi->omtu, pi->link_mode); |
2155 | } | 2161 | } |
2156 | 2162 | ||
2157 | read_unlock_bh(&l2cap_sk_list.lock); | 2163 | read_unlock_bh(&l2cap_sk_list.lock); |
diff --git a/net/core/flow.c b/net/core/flow.c index d137f971f97d..5d25697920b1 100644 --- a/net/core/flow.c +++ b/net/core/flow.c | |||
@@ -231,22 +231,16 @@ nocache: | |||
231 | 231 | ||
232 | err = resolver(key, family, dir, &obj, &obj_ref); | 232 | err = resolver(key, family, dir, &obj, &obj_ref); |
233 | 233 | ||
234 | if (fle) { | 234 | if (fle && !err) { |
235 | if (err) { | 235 | fle->genid = atomic_read(&flow_cache_genid); |
236 | /* Force security policy check on next lookup */ | 236 | |
237 | *head = fle->next; | 237 | if (fle->object) |
238 | flow_entry_kill(cpu, fle); | 238 | atomic_dec(fle->object_ref); |
239 | } else { | 239 | |
240 | fle->genid = atomic_read(&flow_cache_genid); | 240 | fle->object = obj; |
241 | 241 | fle->object_ref = obj_ref; | |
242 | if (fle->object) | 242 | if (obj) |
243 | atomic_dec(fle->object_ref); | 243 | atomic_inc(fle->object_ref); |
244 | |||
245 | fle->object = obj; | ||
246 | fle->object_ref = obj_ref; | ||
247 | if (obj) | ||
248 | atomic_inc(fle->object_ref); | ||
249 | } | ||
250 | } | 244 | } |
251 | local_bh_enable(); | 245 | local_bh_enable(); |
252 | 246 | ||
diff --git a/net/dccp/output.c b/net/dccp/output.c index 824569659083..3435542e9652 100644 --- a/net/dccp/output.c +++ b/net/dccp/output.c | |||
@@ -124,7 +124,7 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb) | |||
124 | DCCP_INC_STATS(DCCP_MIB_OUTSEGS); | 124 | DCCP_INC_STATS(DCCP_MIB_OUTSEGS); |
125 | 125 | ||
126 | memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); | 126 | memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); |
127 | err = icsk->icsk_af_ops->queue_xmit(skb, sk, 0); | 127 | err = icsk->icsk_af_ops->queue_xmit(skb, 0); |
128 | return net_xmit_eval(err); | 128 | return net_xmit_eval(err); |
129 | } | 129 | } |
130 | return -ENOBUFS; | 130 | return -ENOBUFS; |
@@ -396,7 +396,7 @@ int dccp_send_reset(struct sock *sk, enum dccp_reset_codes code) | |||
396 | code); | 396 | code); |
397 | if (skb != NULL) { | 397 | if (skb != NULL) { |
398 | memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); | 398 | memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); |
399 | err = inet_csk(sk)->icsk_af_ops->queue_xmit(skb, sk, 0); | 399 | err = inet_csk(sk)->icsk_af_ops->queue_xmit(skb, 0); |
400 | return net_xmit_eval(err); | 400 | return net_xmit_eval(err); |
401 | } | 401 | } |
402 | } | 402 | } |
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index fc6f3c023a54..ed083ab455b7 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c | |||
@@ -1145,16 +1145,23 @@ struct dn_dev *dn_dev_create(struct net_device *dev, int *err) | |||
1145 | init_timer(&dn_db->timer); | 1145 | init_timer(&dn_db->timer); |
1146 | 1146 | ||
1147 | dn_db->uptime = jiffies; | 1147 | dn_db->uptime = jiffies; |
1148 | |||
1149 | dn_db->neigh_parms = neigh_parms_alloc(dev, &dn_neigh_table); | ||
1150 | if (!dn_db->neigh_parms) { | ||
1151 | dev->dn_ptr = NULL; | ||
1152 | kfree(dn_db); | ||
1153 | return NULL; | ||
1154 | } | ||
1155 | |||
1148 | if (dn_db->parms.up) { | 1156 | if (dn_db->parms.up) { |
1149 | if (dn_db->parms.up(dev) < 0) { | 1157 | if (dn_db->parms.up(dev) < 0) { |
1158 | neigh_parms_release(&dn_neigh_table, dn_db->neigh_parms); | ||
1150 | dev->dn_ptr = NULL; | 1159 | dev->dn_ptr = NULL; |
1151 | kfree(dn_db); | 1160 | kfree(dn_db); |
1152 | return NULL; | 1161 | return NULL; |
1153 | } | 1162 | } |
1154 | } | 1163 | } |
1155 | 1164 | ||
1156 | dn_db->neigh_parms = neigh_parms_alloc(dev, &dn_neigh_table); | ||
1157 | |||
1158 | dn_dev_sysctl_register(dev, &dn_db->parms); | 1165 | dn_dev_sysctl_register(dev, &dn_db->parms); |
1159 | 1166 | ||
1160 | dn_dev_set_timer(dev); | 1167 | dn_dev_set_timer(dev); |
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index cfb249cc0a58..1e589b91605e 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
@@ -1989,6 +1989,10 @@ static struct node *fib_trie_get_next(struct fib_trie_iter *iter) | |||
1989 | unsigned cindex = iter->index; | 1989 | unsigned cindex = iter->index; |
1990 | struct tnode *p; | 1990 | struct tnode *p; |
1991 | 1991 | ||
1992 | /* A single entry routing table */ | ||
1993 | if (!tn) | ||
1994 | return NULL; | ||
1995 | |||
1992 | pr_debug("get_next iter={node=%p index=%d depth=%d}\n", | 1996 | pr_debug("get_next iter={node=%p index=%d depth=%d}\n", |
1993 | iter->tnode, iter->index, iter->depth); | 1997 | iter->tnode, iter->index, iter->depth); |
1994 | rescan: | 1998 | rescan: |
@@ -2037,11 +2041,18 @@ static struct node *fib_trie_get_first(struct fib_trie_iter *iter, | |||
2037 | if(!iter) | 2041 | if(!iter) |
2038 | return NULL; | 2042 | return NULL; |
2039 | 2043 | ||
2040 | if (n && IS_TNODE(n)) { | 2044 | if (n) { |
2041 | iter->tnode = (struct tnode *) n; | 2045 | if (IS_TNODE(n)) { |
2042 | iter->trie = t; | 2046 | iter->tnode = (struct tnode *) n; |
2043 | iter->index = 0; | 2047 | iter->trie = t; |
2044 | iter->depth = 1; | 2048 | iter->index = 0; |
2049 | iter->depth = 1; | ||
2050 | } else { | ||
2051 | iter->tnode = NULL; | ||
2052 | iter->trie = t; | ||
2053 | iter->index = 0; | ||
2054 | iter->depth = 0; | ||
2055 | } | ||
2045 | return n; | 2056 | return n; |
2046 | } | 2057 | } |
2047 | return NULL; | 2058 | return NULL; |
@@ -2279,16 +2290,17 @@ static int fib_trie_seq_show(struct seq_file *seq, void *v) | |||
2279 | if (v == SEQ_START_TOKEN) | 2290 | if (v == SEQ_START_TOKEN) |
2280 | return 0; | 2291 | return 0; |
2281 | 2292 | ||
2293 | if (!NODE_PARENT(n)) { | ||
2294 | if (iter->trie == trie_local) | ||
2295 | seq_puts(seq, "<local>:\n"); | ||
2296 | else | ||
2297 | seq_puts(seq, "<main>:\n"); | ||
2298 | } | ||
2299 | |||
2282 | if (IS_TNODE(n)) { | 2300 | if (IS_TNODE(n)) { |
2283 | struct tnode *tn = (struct tnode *) n; | 2301 | struct tnode *tn = (struct tnode *) n; |
2284 | __be32 prf = htonl(MASK_PFX(tn->key, tn->pos)); | 2302 | __be32 prf = htonl(MASK_PFX(tn->key, tn->pos)); |
2285 | 2303 | ||
2286 | if (!NODE_PARENT(n)) { | ||
2287 | if (iter->trie == trie_local) | ||
2288 | seq_puts(seq, "<local>:\n"); | ||
2289 | else | ||
2290 | seq_puts(seq, "<main>:\n"); | ||
2291 | } | ||
2292 | seq_indent(seq, iter->depth-1); | 2304 | seq_indent(seq, iter->depth-1); |
2293 | seq_printf(seq, " +-- %d.%d.%d.%d/%d %d %d %d\n", | 2305 | seq_printf(seq, " +-- %d.%d.%d.%d/%d %d %d %d\n", |
2294 | NIPQUAD(prf), tn->pos, tn->bits, tn->full_children, | 2306 | NIPQUAD(prf), tn->pos, tn->bits, tn->full_children, |
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index f071f84808fa..a0f2008584bc 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -281,8 +281,9 @@ int ip_output(struct sk_buff *skb) | |||
281 | !(IPCB(skb)->flags & IPSKB_REROUTED)); | 281 | !(IPCB(skb)->flags & IPSKB_REROUTED)); |
282 | } | 282 | } |
283 | 283 | ||
284 | int ip_queue_xmit(struct sk_buff *skb, struct sock *sk, int ipfragok) | 284 | int ip_queue_xmit(struct sk_buff *skb, int ipfragok) |
285 | { | 285 | { |
286 | struct sock *sk = skb->sk; | ||
286 | struct inet_sock *inet = inet_sk(sk); | 287 | struct inet_sock *inet = inet_sk(sk); |
287 | struct ip_options *opt = inet->opt; | 288 | struct ip_options *opt = inet->opt; |
288 | struct rtable *rt; | 289 | struct rtable *rt; |
diff --git a/net/ipv4/netfilter/Makefile b/net/ipv4/netfilter/Makefile index 15e741aeb291..16d177b71bf8 100644 --- a/net/ipv4/netfilter/Makefile +++ b/net/ipv4/netfilter/Makefile | |||
@@ -4,6 +4,14 @@ | |||
4 | 4 | ||
5 | # objects for the standalone - connection tracking / NAT | 5 | # objects for the standalone - connection tracking / NAT |
6 | ip_conntrack-objs := ip_conntrack_standalone.o ip_conntrack_core.o ip_conntrack_proto_generic.o ip_conntrack_proto_tcp.o ip_conntrack_proto_udp.o ip_conntrack_proto_icmp.o | 6 | ip_conntrack-objs := ip_conntrack_standalone.o ip_conntrack_core.o ip_conntrack_proto_generic.o ip_conntrack_proto_tcp.o ip_conntrack_proto_udp.o ip_conntrack_proto_icmp.o |
7 | # objects for l3 independent conntrack | ||
8 | nf_conntrack_ipv4-objs := nf_conntrack_l3proto_ipv4.o nf_conntrack_proto_icmp.o | ||
9 | ifeq ($(CONFIG_NF_CONNTRACK_PROC_COMPAT),y) | ||
10 | ifeq ($(CONFIG_PROC_FS),y) | ||
11 | nf_conntrack_ipv4-objs += nf_conntrack_l3proto_ipv4_compat.o | ||
12 | endif | ||
13 | endif | ||
14 | |||
7 | ip_nat-objs := ip_nat_core.o ip_nat_helper.o ip_nat_proto_unknown.o ip_nat_proto_tcp.o ip_nat_proto_udp.o ip_nat_proto_icmp.o | 15 | ip_nat-objs := ip_nat_core.o ip_nat_helper.o ip_nat_proto_unknown.o ip_nat_proto_tcp.o ip_nat_proto_udp.o ip_nat_proto_icmp.o |
8 | nf_nat-objs := nf_nat_core.o nf_nat_helper.o nf_nat_proto_unknown.o nf_nat_proto_tcp.o nf_nat_proto_udp.o nf_nat_proto_icmp.o | 16 | nf_nat-objs := nf_nat_core.o nf_nat_helper.o nf_nat_proto_unknown.o nf_nat_proto_tcp.o nf_nat_proto_udp.o nf_nat_proto_icmp.o |
9 | ifneq ($(CONFIG_NF_NAT),) | 17 | ifneq ($(CONFIG_NF_NAT),) |
@@ -20,6 +28,8 @@ ip_nat_h323-objs := ip_nat_helper_h323.o | |||
20 | 28 | ||
21 | # connection tracking | 29 | # connection tracking |
22 | obj-$(CONFIG_IP_NF_CONNTRACK) += ip_conntrack.o | 30 | obj-$(CONFIG_IP_NF_CONNTRACK) += ip_conntrack.o |
31 | obj-$(CONFIG_NF_CONNTRACK_IPV4) += nf_conntrack_ipv4.o | ||
32 | |||
23 | obj-$(CONFIG_IP_NF_NAT) += ip_nat.o | 33 | obj-$(CONFIG_IP_NF_NAT) += ip_nat.o |
24 | obj-$(CONFIG_NF_NAT) += nf_nat.o | 34 | obj-$(CONFIG_NF_NAT) += nf_nat.o |
25 | 35 | ||
@@ -106,13 +116,3 @@ obj-$(CONFIG_IP_NF_ARPFILTER) += arptable_filter.o | |||
106 | 116 | ||
107 | obj-$(CONFIG_IP_NF_QUEUE) += ip_queue.o | 117 | obj-$(CONFIG_IP_NF_QUEUE) += ip_queue.o |
108 | 118 | ||
109 | # objects for l3 independent conntrack | ||
110 | nf_conntrack_ipv4-objs := nf_conntrack_l3proto_ipv4.o nf_conntrack_proto_icmp.o | ||
111 | ifeq ($(CONFIG_NF_CONNTRACK_PROC_COMPAT),y) | ||
112 | ifeq ($(CONFIG_PROC_FS),y) | ||
113 | nf_conntrack_ipv4-objs += nf_conntrack_l3proto_ipv4_compat.o | ||
114 | endif | ||
115 | endif | ||
116 | |||
117 | # l3 independent conntrack | ||
118 | obj-$(CONFIG_NF_CONNTRACK_IPV4) += nf_conntrack_ipv4.o | ||
diff --git a/net/ipv4/netfilter/ip_conntrack_netlink.c b/net/ipv4/netfilter/ip_conntrack_netlink.c index 5fcf91d617cd..6f31fad9be13 100644 --- a/net/ipv4/netfilter/ip_conntrack_netlink.c +++ b/net/ipv4/netfilter/ip_conntrack_netlink.c | |||
@@ -959,7 +959,7 @@ ctnetlink_create_conntrack(struct nfattr *cda[], | |||
959 | if (cda[CTA_PROTOINFO-1]) { | 959 | if (cda[CTA_PROTOINFO-1]) { |
960 | err = ctnetlink_change_protoinfo(ct, cda); | 960 | err = ctnetlink_change_protoinfo(ct, cda); |
961 | if (err < 0) | 961 | if (err < 0) |
962 | return err; | 962 | goto err; |
963 | } | 963 | } |
964 | 964 | ||
965 | #if defined(CONFIG_IP_NF_CONNTRACK_MARK) | 965 | #if defined(CONFIG_IP_NF_CONNTRACK_MARK) |
diff --git a/net/ipv4/netfilter/nf_nat_pptp.c b/net/ipv4/netfilter/nf_nat_pptp.c index 0ae45b79a4eb..5df4fcae3ab6 100644 --- a/net/ipv4/netfilter/nf_nat_pptp.c +++ b/net/ipv4/netfilter/nf_nat_pptp.c | |||
@@ -72,9 +72,9 @@ static void pptp_nat_expected(struct nf_conn *ct, | |||
72 | DEBUGP("we are PAC->PNS\n"); | 72 | DEBUGP("we are PAC->PNS\n"); |
73 | /* build tuple for PNS->PAC */ | 73 | /* build tuple for PNS->PAC */ |
74 | t.src.l3num = AF_INET; | 74 | t.src.l3num = AF_INET; |
75 | t.src.u3.ip = master->tuplehash[exp->dir].tuple.src.u3.ip; | 75 | t.src.u3.ip = master->tuplehash[!exp->dir].tuple.src.u3.ip; |
76 | t.src.u.gre.key = nat_pptp_info->pns_call_id; | 76 | t.src.u.gre.key = nat_pptp_info->pns_call_id; |
77 | t.dst.u3.ip = master->tuplehash[exp->dir].tuple.dst.u3.ip; | 77 | t.dst.u3.ip = master->tuplehash[!exp->dir].tuple.dst.u3.ip; |
78 | t.dst.u.gre.key = nat_pptp_info->pac_call_id; | 78 | t.dst.u.gre.key = nat_pptp_info->pac_call_id; |
79 | t.dst.protonum = IPPROTO_GRE; | 79 | t.dst.protonum = IPPROTO_GRE; |
80 | } | 80 | } |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index c701f6abbfc1..c26076fb890e 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -1011,10 +1011,11 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_ | |||
1011 | for (j = 0; j < i; j++){ | 1011 | for (j = 0; j < i; j++){ |
1012 | if (after(ntohl(sp[j].start_seq), | 1012 | if (after(ntohl(sp[j].start_seq), |
1013 | ntohl(sp[j+1].start_seq))){ | 1013 | ntohl(sp[j+1].start_seq))){ |
1014 | sp[j].start_seq = htonl(tp->recv_sack_cache[j+1].start_seq); | 1014 | struct tcp_sack_block_wire tmp; |
1015 | sp[j].end_seq = htonl(tp->recv_sack_cache[j+1].end_seq); | 1015 | |
1016 | sp[j+1].start_seq = htonl(tp->recv_sack_cache[j].start_seq); | 1016 | tmp = sp[j]; |
1017 | sp[j+1].end_seq = htonl(tp->recv_sack_cache[j].end_seq); | 1017 | sp[j] = sp[j+1]; |
1018 | sp[j+1] = tmp; | ||
1018 | } | 1019 | } |
1019 | 1020 | ||
1020 | } | 1021 | } |
@@ -4420,9 +4421,11 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | |||
4420 | * But, this leaves one open to an easy denial of | 4421 | * But, this leaves one open to an easy denial of |
4421 | * service attack, and SYN cookies can't defend | 4422 | * service attack, and SYN cookies can't defend |
4422 | * against this problem. So, we drop the data | 4423 | * against this problem. So, we drop the data |
4423 | * in the interest of security over speed. | 4424 | * in the interest of security over speed unless |
4425 | * it's still in use. | ||
4424 | */ | 4426 | */ |
4425 | goto discard; | 4427 | kfree_skb(skb); |
4428 | return 0; | ||
4426 | } | 4429 | } |
4427 | goto discard; | 4430 | goto discard; |
4428 | 4431 | ||
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 32c1a972fa31..975f4472af29 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -467,6 +467,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
467 | 467 | ||
468 | th = (struct tcphdr *) skb_push(skb, tcp_header_size); | 468 | th = (struct tcphdr *) skb_push(skb, tcp_header_size); |
469 | skb->h.th = th; | 469 | skb->h.th = th; |
470 | skb_set_owner_w(skb, sk); | ||
470 | 471 | ||
471 | /* Build TCP header and checksum it. */ | 472 | /* Build TCP header and checksum it. */ |
472 | th->source = inet->sport; | 473 | th->source = inet->sport; |
@@ -540,7 +541,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
540 | if (after(tcb->end_seq, tp->snd_nxt) || tcb->seq == tcb->end_seq) | 541 | if (after(tcb->end_seq, tp->snd_nxt) || tcb->seq == tcb->end_seq) |
541 | TCP_INC_STATS(TCP_MIB_OUTSEGS); | 542 | TCP_INC_STATS(TCP_MIB_OUTSEGS); |
542 | 543 | ||
543 | err = icsk->icsk_af_ops->queue_xmit(skb, sk, 0); | 544 | err = icsk->icsk_af_ops->queue_xmit(skb, 0); |
544 | if (likely(err <= 0)) | 545 | if (likely(err <= 0)) |
545 | return err; | 546 | return err; |
546 | 547 | ||
@@ -1650,7 +1651,8 @@ static void tcp_retrans_try_collapse(struct sock *sk, struct sk_buff *skb, int m | |||
1650 | 1651 | ||
1651 | memcpy(skb_put(skb, next_skb_size), next_skb->data, next_skb_size); | 1652 | memcpy(skb_put(skb, next_skb_size), next_skb->data, next_skb_size); |
1652 | 1653 | ||
1653 | skb->ip_summed = next_skb->ip_summed; | 1654 | if (next_skb->ip_summed == CHECKSUM_PARTIAL) |
1655 | skb->ip_summed = CHECKSUM_PARTIAL; | ||
1654 | 1656 | ||
1655 | if (skb->ip_summed != CHECKSUM_PARTIAL) | 1657 | if (skb->ip_summed != CHECKSUM_PARTIAL) |
1656 | skb->csum = csum_block_add(skb->csum, next_skb->csum, skb_size); | 1658 | skb->csum = csum_block_add(skb->csum, next_skb->csum, skb_size); |
diff --git a/net/ipv4/tcp_probe.c b/net/ipv4/tcp_probe.c index f230eeecf092..41c157848181 100644 --- a/net/ipv4/tcp_probe.c +++ b/net/ipv4/tcp_probe.c | |||
@@ -30,7 +30,7 @@ | |||
30 | 30 | ||
31 | #include <net/tcp.h> | 31 | #include <net/tcp.h> |
32 | 32 | ||
33 | MODULE_AUTHOR("Stephen Hemminger <shemminger@osdl.org>"); | 33 | MODULE_AUTHOR("Stephen Hemminger <shemminger@linux-foundation.org>"); |
34 | MODULE_DESCRIPTION("TCP cwnd snooper"); | 34 | MODULE_DESCRIPTION("TCP cwnd snooper"); |
35 | MODULE_LICENSE("GPL"); | 35 | MODULE_LICENSE("GPL"); |
36 | 36 | ||
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 171e5b55d7d6..2a7e4618f526 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -341,6 +341,7 @@ void in6_dev_finish_destroy(struct inet6_dev *idev) | |||
341 | static struct inet6_dev * ipv6_add_dev(struct net_device *dev) | 341 | static struct inet6_dev * ipv6_add_dev(struct net_device *dev) |
342 | { | 342 | { |
343 | struct inet6_dev *ndev; | 343 | struct inet6_dev *ndev; |
344 | struct in6_addr maddr; | ||
344 | 345 | ||
345 | ASSERT_RTNL(); | 346 | ASSERT_RTNL(); |
346 | 347 | ||
@@ -425,6 +426,11 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev) | |||
425 | #endif | 426 | #endif |
426 | /* protected by rtnl_lock */ | 427 | /* protected by rtnl_lock */ |
427 | rcu_assign_pointer(dev->ip6_ptr, ndev); | 428 | rcu_assign_pointer(dev->ip6_ptr, ndev); |
429 | |||
430 | /* Join all-node multicast group */ | ||
431 | ipv6_addr_all_nodes(&maddr); | ||
432 | ipv6_dev_mc_inc(dev, &maddr); | ||
433 | |||
428 | return ndev; | 434 | return ndev; |
429 | } | 435 | } |
430 | 436 | ||
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c index c700302ad51a..116f94a49071 100644 --- a/net/ipv6/inet6_connection_sock.c +++ b/net/ipv6/inet6_connection_sock.c | |||
@@ -139,8 +139,9 @@ void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr * uaddr) | |||
139 | 139 | ||
140 | EXPORT_SYMBOL_GPL(inet6_csk_addr2sockaddr); | 140 | EXPORT_SYMBOL_GPL(inet6_csk_addr2sockaddr); |
141 | 141 | ||
142 | int inet6_csk_xmit(struct sk_buff *skb, struct sock *sk, int ipfragok) | 142 | int inet6_csk_xmit(struct sk_buff *skb, int ipfragok) |
143 | { | 143 | { |
144 | struct sock *sk = skb->sk; | ||
144 | struct inet_sock *inet = inet_sk(sk); | 145 | struct inet_sock *inet = inet_sk(sk); |
145 | struct ipv6_pinfo *np = inet6_sk(sk); | 146 | struct ipv6_pinfo *np = inet6_sk(sk); |
146 | struct flowi fl; | 147 | struct flowi fl; |
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index a1c231a04ac2..882cde4b4047 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -2258,8 +2258,6 @@ void ipv6_mc_up(struct inet6_dev *idev) | |||
2258 | 2258 | ||
2259 | void ipv6_mc_init_dev(struct inet6_dev *idev) | 2259 | void ipv6_mc_init_dev(struct inet6_dev *idev) |
2260 | { | 2260 | { |
2261 | struct in6_addr maddr; | ||
2262 | |||
2263 | write_lock_bh(&idev->lock); | 2261 | write_lock_bh(&idev->lock); |
2264 | rwlock_init(&idev->mc_lock); | 2262 | rwlock_init(&idev->mc_lock); |
2265 | idev->mc_gq_running = 0; | 2263 | idev->mc_gq_running = 0; |
@@ -2275,10 +2273,6 @@ void ipv6_mc_init_dev(struct inet6_dev *idev) | |||
2275 | idev->mc_maxdelay = IGMP6_UNSOLICITED_IVAL; | 2273 | idev->mc_maxdelay = IGMP6_UNSOLICITED_IVAL; |
2276 | idev->mc_v1_seen = 0; | 2274 | idev->mc_v1_seen = 0; |
2277 | write_unlock_bh(&idev->lock); | 2275 | write_unlock_bh(&idev->lock); |
2278 | |||
2279 | /* Add all-nodes address. */ | ||
2280 | ipv6_addr_all_nodes(&maddr); | ||
2281 | ipv6_dev_mc_inc(idev->dev, &maddr); | ||
2282 | } | 2276 | } |
2283 | 2277 | ||
2284 | /* | 2278 | /* |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 8c3d56871b50..5f0043c30b70 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -2017,6 +2017,7 @@ static inline size_t rt6_nlmsg_size(void) | |||
2017 | + nla_total_size(4) /* RTA_IIF */ | 2017 | + nla_total_size(4) /* RTA_IIF */ |
2018 | + nla_total_size(4) /* RTA_OIF */ | 2018 | + nla_total_size(4) /* RTA_OIF */ |
2019 | + nla_total_size(4) /* RTA_PRIORITY */ | 2019 | + nla_total_size(4) /* RTA_PRIORITY */ |
2020 | + RTAX_MAX * nla_total_size(4) /* RTA_METRICS */ | ||
2020 | + nla_total_size(sizeof(struct rta_cacheinfo)); | 2021 | + nla_total_size(sizeof(struct rta_cacheinfo)); |
2021 | } | 2022 | } |
2022 | 2023 | ||
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index bd1d2de75e45..811e3e782f0f 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c | |||
@@ -981,7 +981,7 @@ ctnetlink_create_conntrack(struct nfattr *cda[], | |||
981 | if (cda[CTA_PROTOINFO-1]) { | 981 | if (cda[CTA_PROTOINFO-1]) { |
982 | err = ctnetlink_change_protoinfo(ct, cda); | 982 | err = ctnetlink_change_protoinfo(ct, cda); |
983 | if (err < 0) | 983 | if (err < 0) |
984 | return err; | 984 | goto err; |
985 | } | 985 | } |
986 | 986 | ||
987 | #if defined(CONFIG_NF_CONNTRACK_MARK) | 987 | #if defined(CONFIG_NF_CONNTRACK_MARK) |
diff --git a/net/netfilter/nf_conntrack_pptp.c b/net/netfilter/nf_conntrack_pptp.c index f0ff00e0d052..c59df3bc2bbd 100644 --- a/net/netfilter/nf_conntrack_pptp.c +++ b/net/netfilter/nf_conntrack_pptp.c | |||
@@ -113,7 +113,7 @@ static void pptp_expectfn(struct nf_conn *ct, | |||
113 | 113 | ||
114 | rcu_read_lock(); | 114 | rcu_read_lock(); |
115 | nf_nat_pptp_expectfn = rcu_dereference(nf_nat_pptp_hook_expectfn); | 115 | nf_nat_pptp_expectfn = rcu_dereference(nf_nat_pptp_hook_expectfn); |
116 | if (nf_nat_pptp_expectfn && ct->status & IPS_NAT_MASK) | 116 | if (nf_nat_pptp_expectfn && ct->master->status & IPS_NAT_MASK) |
117 | nf_nat_pptp_expectfn(ct, exp); | 117 | nf_nat_pptp_expectfn(ct, exp); |
118 | else { | 118 | else { |
119 | struct nf_conntrack_tuple inv_t; | 119 | struct nf_conntrack_tuple inv_t; |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index da73e8a8c18d..6dc01bdeb76b 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -359,6 +359,10 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock, | |||
359 | if (dev == NULL) | 359 | if (dev == NULL) |
360 | goto out_unlock; | 360 | goto out_unlock; |
361 | 361 | ||
362 | err = -ENETDOWN; | ||
363 | if (!(dev->flags & IFF_UP)) | ||
364 | goto out_unlock; | ||
365 | |||
362 | /* | 366 | /* |
363 | * You may not queue a frame bigger than the mtu. This is the lowest level | 367 | * You may not queue a frame bigger than the mtu. This is the lowest level |
364 | * raw protocol and you must do your own fragmentation at this level. | 368 | * raw protocol and you must do your own fragmentation at this level. |
@@ -407,10 +411,6 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock, | |||
407 | if (err) | 411 | if (err) |
408 | goto out_free; | 412 | goto out_free; |
409 | 413 | ||
410 | err = -ENETDOWN; | ||
411 | if (!(dev->flags & IFF_UP)) | ||
412 | goto out_free; | ||
413 | |||
414 | /* | 414 | /* |
415 | * Now send it | 415 | * Now send it |
416 | */ | 416 | */ |
@@ -428,24 +428,18 @@ out_unlock: | |||
428 | } | 428 | } |
429 | #endif | 429 | #endif |
430 | 430 | ||
431 | static inline int run_filter(struct sk_buff *skb, struct sock *sk, | 431 | static inline unsigned int run_filter(struct sk_buff *skb, struct sock *sk, |
432 | unsigned *snaplen) | 432 | unsigned int res) |
433 | { | 433 | { |
434 | struct sk_filter *filter; | 434 | struct sk_filter *filter; |
435 | int err = 0; | ||
436 | 435 | ||
437 | rcu_read_lock_bh(); | 436 | rcu_read_lock_bh(); |
438 | filter = rcu_dereference(sk->sk_filter); | 437 | filter = rcu_dereference(sk->sk_filter); |
439 | if (filter != NULL) { | 438 | if (filter != NULL) |
440 | err = sk_run_filter(skb, filter->insns, filter->len); | 439 | res = sk_run_filter(skb, filter->insns, filter->len); |
441 | if (!err) | ||
442 | err = -EPERM; | ||
443 | else if (*snaplen > err) | ||
444 | *snaplen = err; | ||
445 | } | ||
446 | rcu_read_unlock_bh(); | 440 | rcu_read_unlock_bh(); |
447 | 441 | ||
448 | return err; | 442 | return res; |
449 | } | 443 | } |
450 | 444 | ||
451 | /* | 445 | /* |
@@ -467,7 +461,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet | |||
467 | struct packet_sock *po; | 461 | struct packet_sock *po; |
468 | u8 * skb_head = skb->data; | 462 | u8 * skb_head = skb->data; |
469 | int skb_len = skb->len; | 463 | int skb_len = skb->len; |
470 | unsigned snaplen; | 464 | unsigned int snaplen, res; |
471 | 465 | ||
472 | if (skb->pkt_type == PACKET_LOOPBACK) | 466 | if (skb->pkt_type == PACKET_LOOPBACK) |
473 | goto drop; | 467 | goto drop; |
@@ -495,8 +489,11 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet | |||
495 | 489 | ||
496 | snaplen = skb->len; | 490 | snaplen = skb->len; |
497 | 491 | ||
498 | if (run_filter(skb, sk, &snaplen) < 0) | 492 | res = run_filter(skb, sk, snaplen); |
493 | if (!res) | ||
499 | goto drop_n_restore; | 494 | goto drop_n_restore; |
495 | if (snaplen > res) | ||
496 | snaplen = res; | ||
500 | 497 | ||
501 | if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= | 498 | if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= |
502 | (unsigned)sk->sk_rcvbuf) | 499 | (unsigned)sk->sk_rcvbuf) |
@@ -568,7 +565,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe | |||
568 | struct tpacket_hdr *h; | 565 | struct tpacket_hdr *h; |
569 | u8 * skb_head = skb->data; | 566 | u8 * skb_head = skb->data; |
570 | int skb_len = skb->len; | 567 | int skb_len = skb->len; |
571 | unsigned snaplen; | 568 | unsigned int snaplen, res; |
572 | unsigned long status = TP_STATUS_LOSING|TP_STATUS_USER; | 569 | unsigned long status = TP_STATUS_LOSING|TP_STATUS_USER; |
573 | unsigned short macoff, netoff; | 570 | unsigned short macoff, netoff; |
574 | struct sk_buff *copy_skb = NULL; | 571 | struct sk_buff *copy_skb = NULL; |
@@ -592,8 +589,11 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe | |||
592 | 589 | ||
593 | snaplen = skb->len; | 590 | snaplen = skb->len; |
594 | 591 | ||
595 | if (run_filter(skb, sk, &snaplen) < 0) | 592 | res = run_filter(skb, sk, snaplen); |
593 | if (!res) | ||
596 | goto drop_n_restore; | 594 | goto drop_n_restore; |
595 | if (snaplen > res) | ||
596 | snaplen = res; | ||
597 | 597 | ||
598 | if (sk->sk_type == SOCK_DGRAM) { | 598 | if (sk->sk_type == SOCK_DGRAM) { |
599 | macoff = netoff = TPACKET_ALIGN(TPACKET_HDRLEN) + 16; | 599 | macoff = netoff = TPACKET_ALIGN(TPACKET_HDRLEN) + 16; |
@@ -738,6 +738,10 @@ static int packet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
738 | if (sock->type == SOCK_RAW) | 738 | if (sock->type == SOCK_RAW) |
739 | reserve = dev->hard_header_len; | 739 | reserve = dev->hard_header_len; |
740 | 740 | ||
741 | err = -ENETDOWN; | ||
742 | if (!(dev->flags & IFF_UP)) | ||
743 | goto out_unlock; | ||
744 | |||
741 | err = -EMSGSIZE; | 745 | err = -EMSGSIZE; |
742 | if (len > dev->mtu+reserve) | 746 | if (len > dev->mtu+reserve) |
743 | goto out_unlock; | 747 | goto out_unlock; |
@@ -770,10 +774,6 @@ static int packet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
770 | skb->dev = dev; | 774 | skb->dev = dev; |
771 | skb->priority = sk->sk_priority; | 775 | skb->priority = sk->sk_priority; |
772 | 776 | ||
773 | err = -ENETDOWN; | ||
774 | if (!(dev->flags & IFF_UP)) | ||
775 | goto out_free; | ||
776 | |||
777 | /* | 777 | /* |
778 | * Now send it | 778 | * Now send it |
779 | */ | 779 | */ |
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 225f39b5d595..0ef48126b117 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -804,7 +804,7 @@ static inline int sctp_v4_xmit(struct sk_buff *skb, | |||
804 | NIPQUAD(((struct rtable *)skb->dst)->rt_dst)); | 804 | NIPQUAD(((struct rtable *)skb->dst)->rt_dst)); |
805 | 805 | ||
806 | SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS); | 806 | SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS); |
807 | return ip_queue_xmit(skb, skb->sk, ipfragok); | 807 | return ip_queue_xmit(skb, ipfragok); |
808 | } | 808 | } |
809 | 809 | ||
810 | static struct sctp_af sctp_ipv4_specific; | 810 | static struct sctp_af sctp_ipv4_specific; |
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 167d888d1df2..0b1ddb1005ac 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -1562,7 +1562,7 @@ static int sctp_process_missing_param(const struct sctp_association *asoc, | |||
1562 | if (*errp) { | 1562 | if (*errp) { |
1563 | report.num_missing = htonl(1); | 1563 | report.num_missing = htonl(1); |
1564 | report.type = paramtype; | 1564 | report.type = paramtype; |
1565 | sctp_init_cause(*errp, SCTP_ERROR_INV_PARAM, | 1565 | sctp_init_cause(*errp, SCTP_ERROR_MISS_PARAM, |
1566 | &report, sizeof(report)); | 1566 | &report, sizeof(report)); |
1567 | } | 1567 | } |
1568 | 1568 | ||
@@ -1775,7 +1775,9 @@ int sctp_verify_init(const struct sctp_association *asoc, | |||
1775 | 1775 | ||
1776 | /* Verify stream values are non-zero. */ | 1776 | /* Verify stream values are non-zero. */ |
1777 | if ((0 == peer_init->init_hdr.num_outbound_streams) || | 1777 | if ((0 == peer_init->init_hdr.num_outbound_streams) || |
1778 | (0 == peer_init->init_hdr.num_inbound_streams)) { | 1778 | (0 == peer_init->init_hdr.num_inbound_streams) || |
1779 | (0 == peer_init->init_hdr.init_tag) || | ||
1780 | (SCTP_DEFAULT_MINWINDOW > ntohl(peer_init->init_hdr.a_rwnd))) { | ||
1779 | 1781 | ||
1780 | sctp_process_inv_mandatory(asoc, chunk, errp); | 1782 | sctp_process_inv_mandatory(asoc, chunk, errp); |
1781 | return 0; | 1783 | return 0; |
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c index 7bbc6156e455..8bd30976cdee 100644 --- a/net/sctp/sm_sideeffect.c +++ b/net/sctp/sm_sideeffect.c | |||
@@ -217,7 +217,7 @@ static int sctp_gen_sack(struct sctp_association *asoc, int force, | |||
217 | 217 | ||
218 | asoc->peer.sack_needed = 0; | 218 | asoc->peer.sack_needed = 0; |
219 | 219 | ||
220 | error = sctp_outq_tail(&asoc->outqueue, sack); | 220 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(sack)); |
221 | 221 | ||
222 | /* Stop the SACK timer. */ | 222 | /* Stop the SACK timer. */ |
223 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP, | 223 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP, |
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index aa51d190bfb2..fbbc9e6a3b78 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
@@ -440,7 +440,6 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(const struct sctp_endpoint *ep, | |||
440 | { | 440 | { |
441 | struct sctp_chunk *chunk = arg; | 441 | struct sctp_chunk *chunk = arg; |
442 | sctp_init_chunk_t *initchunk; | 442 | sctp_init_chunk_t *initchunk; |
443 | __u32 init_tag; | ||
444 | struct sctp_chunk *err_chunk; | 443 | struct sctp_chunk *err_chunk; |
445 | struct sctp_packet *packet; | 444 | struct sctp_packet *packet; |
446 | sctp_error_t error; | 445 | sctp_error_t error; |
@@ -462,24 +461,6 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(const struct sctp_endpoint *ep, | |||
462 | /* Grab the INIT header. */ | 461 | /* Grab the INIT header. */ |
463 | chunk->subh.init_hdr = (sctp_inithdr_t *) chunk->skb->data; | 462 | chunk->subh.init_hdr = (sctp_inithdr_t *) chunk->skb->data; |
464 | 463 | ||
465 | init_tag = ntohl(chunk->subh.init_hdr->init_tag); | ||
466 | |||
467 | /* Verification Tag: 3.3.3 | ||
468 | * If the value of the Initiate Tag in a received INIT ACK | ||
469 | * chunk is found to be 0, the receiver MUST treat it as an | ||
470 | * error and close the association by transmitting an ABORT. | ||
471 | */ | ||
472 | if (!init_tag) { | ||
473 | struct sctp_chunk *reply = sctp_make_abort(asoc, chunk, 0); | ||
474 | if (!reply) | ||
475 | goto nomem; | ||
476 | |||
477 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(reply)); | ||
478 | return sctp_stop_t1_and_abort(commands, SCTP_ERROR_INV_PARAM, | ||
479 | ECONNREFUSED, asoc, | ||
480 | chunk->transport); | ||
481 | } | ||
482 | |||
483 | /* Verify the INIT chunk before processing it. */ | 464 | /* Verify the INIT chunk before processing it. */ |
484 | err_chunk = NULL; | 465 | err_chunk = NULL; |
485 | if (!sctp_verify_init(asoc, chunk->chunk_hdr->type, | 466 | if (!sctp_verify_init(asoc, chunk->chunk_hdr->type, |
@@ -550,9 +531,6 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(const struct sctp_endpoint *ep, | |||
550 | SCTP_CHUNK(err_chunk)); | 531 | SCTP_CHUNK(err_chunk)); |
551 | 532 | ||
552 | return SCTP_DISPOSITION_CONSUME; | 533 | return SCTP_DISPOSITION_CONSUME; |
553 | |||
554 | nomem: | ||
555 | return SCTP_DISPOSITION_NOMEM; | ||
556 | } | 534 | } |
557 | 535 | ||
558 | /* | 536 | /* |
@@ -1553,6 +1531,28 @@ sctp_disposition_t sctp_sf_do_5_2_2_dupinit(const struct sctp_endpoint *ep, | |||
1553 | } | 1531 | } |
1554 | 1532 | ||
1555 | 1533 | ||
1534 | /* | ||
1535 | * Unexpected INIT-ACK handler. | ||
1536 | * | ||
1537 | * Section 5.2.3 | ||
1538 | * If an INIT ACK received by an endpoint in any state other than the | ||
1539 | * COOKIE-WAIT state, the endpoint should discard the INIT ACK chunk. | ||
1540 | * An unexpected INIT ACK usually indicates the processing of an old or | ||
1541 | * duplicated INIT chunk. | ||
1542 | */ | ||
1543 | sctp_disposition_t sctp_sf_do_5_2_3_initack(const struct sctp_endpoint *ep, | ||
1544 | const struct sctp_association *asoc, | ||
1545 | const sctp_subtype_t type, | ||
1546 | void *arg, sctp_cmd_seq_t *commands) | ||
1547 | { | ||
1548 | /* Per the above section, we'll discard the chunk if we have an | ||
1549 | * endpoint. If this is an OOTB INIT-ACK, treat it as such. | ||
1550 | */ | ||
1551 | if (ep == sctp_sk((sctp_get_ctl_sock()))->ep) | ||
1552 | return sctp_sf_ootb(ep, asoc, type, arg, commands); | ||
1553 | else | ||
1554 | return sctp_sf_discard_chunk(ep, asoc, type, arg, commands); | ||
1555 | } | ||
1556 | 1556 | ||
1557 | /* Unexpected COOKIE-ECHO handler for peer restart (Table 2, action 'A') | 1557 | /* Unexpected COOKIE-ECHO handler for peer restart (Table 2, action 'A') |
1558 | * | 1558 | * |
diff --git a/net/sctp/sm_statetable.c b/net/sctp/sm_statetable.c index 733dd87b3a7d..5f6cc7aa661b 100644 --- a/net/sctp/sm_statetable.c +++ b/net/sctp/sm_statetable.c | |||
@@ -152,7 +152,7 @@ const sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t event_type, | |||
152 | /* SCTP_STATE_EMPTY */ \ | 152 | /* SCTP_STATE_EMPTY */ \ |
153 | TYPE_SCTP_FUNC(sctp_sf_ootb), \ | 153 | TYPE_SCTP_FUNC(sctp_sf_ootb), \ |
154 | /* SCTP_STATE_CLOSED */ \ | 154 | /* SCTP_STATE_CLOSED */ \ |
155 | TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \ | 155 | TYPE_SCTP_FUNC(sctp_sf_do_5_2_3_initack), \ |
156 | /* SCTP_STATE_COOKIE_WAIT */ \ | 156 | /* SCTP_STATE_COOKIE_WAIT */ \ |
157 | TYPE_SCTP_FUNC(sctp_sf_do_5_1C_ack), \ | 157 | TYPE_SCTP_FUNC(sctp_sf_do_5_1C_ack), \ |
158 | /* SCTP_STATE_COOKIE_ECHOED */ \ | 158 | /* SCTP_STATE_COOKIE_ECHOED */ \ |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index aba528b9ae76..16c9fbc1db69 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -490,16 +490,14 @@ int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg, int flags) | |||
490 | 490 | ||
491 | /* Set up the call info struct and execute the task */ | 491 | /* Set up the call info struct and execute the task */ |
492 | status = task->tk_status; | 492 | status = task->tk_status; |
493 | if (status != 0) { | 493 | if (status != 0) |
494 | rpc_release_task(task); | ||
495 | goto out; | 494 | goto out; |
496 | } | ||
497 | atomic_inc(&task->tk_count); | 495 | atomic_inc(&task->tk_count); |
498 | status = rpc_execute(task); | 496 | status = rpc_execute(task); |
499 | if (status == 0) | 497 | if (status == 0) |
500 | status = task->tk_status; | 498 | status = task->tk_status; |
501 | rpc_put_task(task); | ||
502 | out: | 499 | out: |
500 | rpc_put_task(task); | ||
503 | rpc_restore_sigmask(&oldset); | 501 | rpc_restore_sigmask(&oldset); |
504 | return status; | 502 | return status; |
505 | } | 503 | } |
@@ -537,7 +535,7 @@ rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, int flags, | |||
537 | if (status == 0) | 535 | if (status == 0) |
538 | rpc_execute(task); | 536 | rpc_execute(task); |
539 | else | 537 | else |
540 | rpc_release_task(task); | 538 | rpc_put_task(task); |
541 | 539 | ||
542 | rpc_restore_sigmask(&oldset); | 540 | rpc_restore_sigmask(&oldset); |
543 | return status; | 541 | return status; |
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index 79bc4cdf5d48..fc083f0b3544 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c | |||
@@ -42,6 +42,7 @@ static mempool_t *rpc_buffer_mempool __read_mostly; | |||
42 | static void __rpc_default_timer(struct rpc_task *task); | 42 | static void __rpc_default_timer(struct rpc_task *task); |
43 | static void rpciod_killall(void); | 43 | static void rpciod_killall(void); |
44 | static void rpc_async_schedule(struct work_struct *); | 44 | static void rpc_async_schedule(struct work_struct *); |
45 | static void rpc_release_task(struct rpc_task *task); | ||
45 | 46 | ||
46 | /* | 47 | /* |
47 | * RPC tasks sit here while waiting for conditions to improve. | 48 | * RPC tasks sit here while waiting for conditions to improve. |
@@ -896,7 +897,7 @@ void rpc_put_task(struct rpc_task *task) | |||
896 | } | 897 | } |
897 | EXPORT_SYMBOL(rpc_put_task); | 898 | EXPORT_SYMBOL(rpc_put_task); |
898 | 899 | ||
899 | void rpc_release_task(struct rpc_task *task) | 900 | static void rpc_release_task(struct rpc_task *task) |
900 | { | 901 | { |
901 | #ifdef RPC_DEBUG | 902 | #ifdef RPC_DEBUG |
902 | BUG_ON(task->tk_magic != RPC_TASK_MAGIC_ID); | 903 | BUG_ON(task->tk_magic != RPC_TASK_MAGIC_ID); |
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index f3001f3626f6..4c1611211119 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/sunrpc/clnt.h> | 26 | #include <linux/sunrpc/clnt.h> |
27 | 27 | ||
28 | #define RPCDBG_FACILITY RPCDBG_SVCDSP | 28 | #define RPCDBG_FACILITY RPCDBG_SVCDSP |
29 | #define RPC_PARANOIA 1 | ||
30 | 29 | ||
31 | /* | 30 | /* |
32 | * Mode for mapping cpus to pools. | 31 | * Mode for mapping cpus to pools. |
@@ -872,15 +871,15 @@ svc_process(struct svc_rqst *rqstp) | |||
872 | return 0; | 871 | return 0; |
873 | 872 | ||
874 | err_short_len: | 873 | err_short_len: |
875 | #ifdef RPC_PARANOIA | 874 | if (net_ratelimit()) |
876 | printk("svc: short len %Zd, dropping request\n", argv->iov_len); | 875 | printk("svc: short len %Zd, dropping request\n", argv->iov_len); |
877 | #endif | 876 | |
878 | goto dropit; /* drop request */ | 877 | goto dropit; /* drop request */ |
879 | 878 | ||
880 | err_bad_dir: | 879 | err_bad_dir: |
881 | #ifdef RPC_PARANOIA | 880 | if (net_ratelimit()) |
882 | printk("svc: bad direction %d, dropping request\n", dir); | 881 | printk("svc: bad direction %d, dropping request\n", dir); |
883 | #endif | 882 | |
884 | serv->sv_stats->rpcbadfmt++; | 883 | serv->sv_stats->rpcbadfmt++; |
885 | goto dropit; /* drop request */ | 884 | goto dropit; /* drop request */ |
886 | 885 | ||
@@ -909,9 +908,10 @@ err_bad_prog: | |||
909 | goto sendit; | 908 | goto sendit; |
910 | 909 | ||
911 | err_bad_vers: | 910 | err_bad_vers: |
912 | #ifdef RPC_PARANOIA | 911 | if (net_ratelimit()) |
913 | printk("svc: unknown version (%d)\n", vers); | 912 | printk("svc: unknown version (%d for prog %d, %s)\n", |
914 | #endif | 913 | vers, prog, progp->pg_name); |
914 | |||
915 | serv->sv_stats->rpcbadfmt++; | 915 | serv->sv_stats->rpcbadfmt++; |
916 | svc_putnl(resv, RPC_PROG_MISMATCH); | 916 | svc_putnl(resv, RPC_PROG_MISMATCH); |
917 | svc_putnl(resv, progp->pg_lovers); | 917 | svc_putnl(resv, progp->pg_lovers); |
@@ -919,17 +919,17 @@ err_bad_vers: | |||
919 | goto sendit; | 919 | goto sendit; |
920 | 920 | ||
921 | err_bad_proc: | 921 | err_bad_proc: |
922 | #ifdef RPC_PARANOIA | 922 | if (net_ratelimit()) |
923 | printk("svc: unknown procedure (%d)\n", proc); | 923 | printk("svc: unknown procedure (%d)\n", proc); |
924 | #endif | 924 | |
925 | serv->sv_stats->rpcbadfmt++; | 925 | serv->sv_stats->rpcbadfmt++; |
926 | svc_putnl(resv, RPC_PROC_UNAVAIL); | 926 | svc_putnl(resv, RPC_PROC_UNAVAIL); |
927 | goto sendit; | 927 | goto sendit; |
928 | 928 | ||
929 | err_garbage: | 929 | err_garbage: |
930 | #ifdef RPC_PARANOIA | 930 | if (net_ratelimit()) |
931 | printk("svc: failed to decode args\n"); | 931 | printk("svc: failed to decode args\n"); |
932 | #endif | 932 | |
933 | rpc_stat = rpc_garbage_args; | 933 | rpc_stat = rpc_garbage_args; |
934 | err_bad: | 934 | err_bad: |
935 | serv->sv_stats->rpcbadfmt++; | 935 | serv->sv_stats->rpcbadfmt++; |
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 99f54fb6d669..ff1f8bf680aa 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
@@ -1062,15 +1062,19 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp) | |||
1062 | * bit set in the fragment length header. | 1062 | * bit set in the fragment length header. |
1063 | * But apparently no known nfs clients send fragmented | 1063 | * But apparently no known nfs clients send fragmented |
1064 | * records. */ | 1064 | * records. */ |
1065 | printk(KERN_NOTICE "RPC: bad TCP reclen 0x%08lx (non-terminal)\n", | 1065 | if (net_ratelimit()) |
1066 | (unsigned long) svsk->sk_reclen); | 1066 | printk(KERN_NOTICE "RPC: bad TCP reclen 0x%08lx" |
1067 | " (non-terminal)\n", | ||
1068 | (unsigned long) svsk->sk_reclen); | ||
1067 | goto err_delete; | 1069 | goto err_delete; |
1068 | } | 1070 | } |
1069 | svsk->sk_reclen &= 0x7fffffff; | 1071 | svsk->sk_reclen &= 0x7fffffff; |
1070 | dprintk("svc: TCP record, %d bytes\n", svsk->sk_reclen); | 1072 | dprintk("svc: TCP record, %d bytes\n", svsk->sk_reclen); |
1071 | if (svsk->sk_reclen > serv->sv_max_mesg) { | 1073 | if (svsk->sk_reclen > serv->sv_max_mesg) { |
1072 | printk(KERN_NOTICE "RPC: bad TCP reclen 0x%08lx (large)\n", | 1074 | if (net_ratelimit()) |
1073 | (unsigned long) svsk->sk_reclen); | 1075 | printk(KERN_NOTICE "RPC: bad TCP reclen 0x%08lx" |
1076 | " (large)\n", | ||
1077 | (unsigned long) svsk->sk_reclen); | ||
1074 | goto err_delete; | 1078 | goto err_delete; |
1075 | } | 1079 | } |
1076 | } | 1080 | } |
@@ -1278,6 +1282,8 @@ svc_recv(struct svc_rqst *rqstp, long timeout) | |||
1278 | schedule_timeout_uninterruptible(msecs_to_jiffies(500)); | 1282 | schedule_timeout_uninterruptible(msecs_to_jiffies(500)); |
1279 | rqstp->rq_pages[i] = p; | 1283 | rqstp->rq_pages[i] = p; |
1280 | } | 1284 | } |
1285 | rqstp->rq_pages[i++] = NULL; /* this might be seen in nfs_read_actor */ | ||
1286 | BUG_ON(pages >= RPCSVC_MAXPAGES); | ||
1281 | 1287 | ||
1282 | /* Make arg->head point to first page and arg->pages point to rest */ | 1288 | /* Make arg->head point to first page and arg->pages point to rest */ |
1283 | arg = &rqstp->rq_arg; | 1289 | arg = &rqstp->rq_arg; |
diff --git a/net/x25/x25_dev.c b/net/x25/x25_dev.c index 47b68a301677..328d80f000ad 100644 --- a/net/x25/x25_dev.c +++ b/net/x25/x25_dev.c | |||
@@ -56,6 +56,7 @@ static int x25_receive_data(struct sk_buff *skb, struct x25_neigh *nb) | |||
56 | sk_add_backlog(sk, skb); | 56 | sk_add_backlog(sk, skb); |
57 | } | 57 | } |
58 | bh_unlock_sock(sk); | 58 | bh_unlock_sock(sk); |
59 | sock_put(sk); | ||
59 | return queued; | 60 | return queued; |
60 | } | 61 | } |
61 | 62 | ||
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index bebd40e5a62e..b7e537fe2d75 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -650,19 +650,18 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl) | |||
650 | struct xfrm_policy *pol; | 650 | struct xfrm_policy *pol; |
651 | struct xfrm_policy *delpol; | 651 | struct xfrm_policy *delpol; |
652 | struct hlist_head *chain; | 652 | struct hlist_head *chain; |
653 | struct hlist_node *entry, *newpos, *last; | 653 | struct hlist_node *entry, *newpos; |
654 | struct dst_entry *gc_list; | 654 | struct dst_entry *gc_list; |
655 | 655 | ||
656 | write_lock_bh(&xfrm_policy_lock); | 656 | write_lock_bh(&xfrm_policy_lock); |
657 | chain = policy_hash_bysel(&policy->selector, policy->family, dir); | 657 | chain = policy_hash_bysel(&policy->selector, policy->family, dir); |
658 | delpol = NULL; | 658 | delpol = NULL; |
659 | newpos = NULL; | 659 | newpos = NULL; |
660 | last = NULL; | ||
661 | hlist_for_each_entry(pol, entry, chain, bydst) { | 660 | hlist_for_each_entry(pol, entry, chain, bydst) { |
662 | if (!delpol && | 661 | if (pol->type == policy->type && |
663 | pol->type == policy->type && | ||
664 | !selector_cmp(&pol->selector, &policy->selector) && | 662 | !selector_cmp(&pol->selector, &policy->selector) && |
665 | xfrm_sec_ctx_match(pol->security, policy->security)) { | 663 | xfrm_sec_ctx_match(pol->security, policy->security) && |
664 | !WARN_ON(delpol)) { | ||
666 | if (excl) { | 665 | if (excl) { |
667 | write_unlock_bh(&xfrm_policy_lock); | 666 | write_unlock_bh(&xfrm_policy_lock); |
668 | return -EEXIST; | 667 | return -EEXIST; |
@@ -671,17 +670,12 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl) | |||
671 | if (policy->priority > pol->priority) | 670 | if (policy->priority > pol->priority) |
672 | continue; | 671 | continue; |
673 | } else if (policy->priority >= pol->priority) { | 672 | } else if (policy->priority >= pol->priority) { |
674 | last = &pol->bydst; | 673 | newpos = &pol->bydst; |
675 | continue; | 674 | continue; |
676 | } | 675 | } |
677 | if (!newpos) | ||
678 | newpos = &pol->bydst; | ||
679 | if (delpol) | 676 | if (delpol) |
680 | break; | 677 | break; |
681 | last = &pol->bydst; | ||
682 | } | 678 | } |
683 | if (!newpos) | ||
684 | newpos = last; | ||
685 | if (newpos) | 679 | if (newpos) |
686 | hlist_add_after(newpos, &policy->bydst); | 680 | hlist_add_after(newpos, &policy->bydst); |
687 | else | 681 | else |