aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-11-29 03:50:33 -0500
committerJeff Garzik <jgarzik@pobox.com>2005-11-29 03:50:33 -0500
commit2226340eb8df9c42f9fca74582d08d5117fc0cec (patch)
treec98370844715194600b79f886dbc391633f3e470 /net
parent2e06cb5859fdaeba0529806eb1bf161ffd0db201 (diff)
parent624f54be206adf970cd8eece16446b027913e533 (diff)
Merge branch 'master'
Diffstat (limited to 'net')
-rw-r--r--net/bridge/br_if.c1
-rw-r--r--net/core/filter.c6
-rw-r--r--net/dccp/proto.c1
-rw-r--r--net/ipv4/devinet.c40
-rw-r--r--net/ipv4/fib_frontend.c2
-rw-r--r--net/ipv4/fib_trie.c3
-rw-r--r--net/ipv4/netfilter/Kconfig10
-rw-r--r--net/ipv4/netfilter/ip_conntrack_netlink.c25
-rw-r--r--net/ipv6/addrconf.c10
-rw-r--r--net/ipv6/datagram.c2
-rw-r--r--net/ipv6/exthdrs.c22
-rw-r--r--net/ipv6/ip6_flowlabel.c16
-rw-r--r--net/ipv6/raw.c4
-rw-r--r--net/ipv6/udp.c4
-rw-r--r--net/netlink/af_netlink.c2
-rw-r--r--net/sched/sch_netem.c2
-rw-r--r--net/sunrpc/rpc_pipe.c26
17 files changed, 114 insertions, 62 deletions
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index defcf6a8607c..975abe254b7a 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -366,6 +366,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
366 366
367 spin_lock_bh(&br->lock); 367 spin_lock_bh(&br->lock);
368 br_stp_recalculate_bridge_id(br); 368 br_stp_recalculate_bridge_id(br);
369 br_features_recompute(br);
369 if ((br->dev->flags & IFF_UP) 370 if ((br->dev->flags & IFF_UP)
370 && (dev->flags & IFF_UP) && netif_carrier_ok(dev)) 371 && (dev->flags & IFF_UP) && netif_carrier_ok(dev))
371 br_stp_enable_port(p); 372 br_stp_enable_port(p);
diff --git a/net/core/filter.c b/net/core/filter.c
index 079c2edff789..2841bfce29d6 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -116,8 +116,6 @@ int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen)
116 A /= X; 116 A /= X;
117 continue; 117 continue;
118 case BPF_ALU|BPF_DIV|BPF_K: 118 case BPF_ALU|BPF_DIV|BPF_K:
119 if (fentry->k == 0)
120 return 0;
121 A /= fentry->k; 119 A /= fentry->k;
122 continue; 120 continue;
123 case BPF_ALU|BPF_AND|BPF_X: 121 case BPF_ALU|BPF_AND|BPF_X:
@@ -320,6 +318,10 @@ int sk_chk_filter(struct sock_filter *filter, int flen)
320 } 318 }
321 } 319 }
322 320
321 /* check for division by zero -Kris Katterjohn 2005-10-30 */
322 if (ftest->code == (BPF_ALU|BPF_DIV|BPF_K) && ftest->k == 0)
323 return -EINVAL;
324
323 /* check that memory operations use valid addresses. */ 325 /* check that memory operations use valid addresses. */
324 if (ftest->k >= BPF_MEMWORDS) { 326 if (ftest->k >= BPF_MEMWORDS) {
325 /* but it might not be a memory operation... */ 327 /* but it might not be a memory operation... */
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index e0ace7cbb996..8a6b2a9e4581 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -46,6 +46,7 @@ atomic_t dccp_orphan_count = ATOMIC_INIT(0);
46static struct net_protocol dccp_protocol = { 46static struct net_protocol dccp_protocol = {
47 .handler = dccp_v4_rcv, 47 .handler = dccp_v4_rcv,
48 .err_handler = dccp_v4_err, 48 .err_handler = dccp_v4_err,
49 .no_policy = 1,
49}; 50};
50 51
51const char *dccp_packet_name(const int type) 52const char *dccp_packet_name(const int type)
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 4ec4b2ca6ab1..04a6fe3e95a2 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -234,7 +234,10 @@ static void inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap,
234 int destroy) 234 int destroy)
235{ 235{
236 struct in_ifaddr *promote = NULL; 236 struct in_ifaddr *promote = NULL;
237 struct in_ifaddr *ifa1 = *ifap; 237 struct in_ifaddr *ifa, *ifa1 = *ifap;
238 struct in_ifaddr *last_prim = in_dev->ifa_list;
239 struct in_ifaddr *prev_prom = NULL;
240 int do_promote = IN_DEV_PROMOTE_SECONDARIES(in_dev);
238 241
239 ASSERT_RTNL(); 242 ASSERT_RTNL();
240 243
@@ -243,18 +246,22 @@ static void inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap,
243 **/ 246 **/
244 247
245 if (!(ifa1->ifa_flags & IFA_F_SECONDARY)) { 248 if (!(ifa1->ifa_flags & IFA_F_SECONDARY)) {
246 struct in_ifaddr *ifa;
247 struct in_ifaddr **ifap1 = &ifa1->ifa_next; 249 struct in_ifaddr **ifap1 = &ifa1->ifa_next;
248 250
249 while ((ifa = *ifap1) != NULL) { 251 while ((ifa = *ifap1) != NULL) {
252 if (!(ifa->ifa_flags & IFA_F_SECONDARY) &&
253 ifa1->ifa_scope <= ifa->ifa_scope)
254 last_prim = ifa;
255
250 if (!(ifa->ifa_flags & IFA_F_SECONDARY) || 256 if (!(ifa->ifa_flags & IFA_F_SECONDARY) ||
251 ifa1->ifa_mask != ifa->ifa_mask || 257 ifa1->ifa_mask != ifa->ifa_mask ||
252 !inet_ifa_match(ifa1->ifa_address, ifa)) { 258 !inet_ifa_match(ifa1->ifa_address, ifa)) {
253 ifap1 = &ifa->ifa_next; 259 ifap1 = &ifa->ifa_next;
260 prev_prom = ifa;
254 continue; 261 continue;
255 } 262 }
256 263
257 if (!IN_DEV_PROMOTE_SECONDARIES(in_dev)) { 264 if (!do_promote) {
258 *ifap1 = ifa->ifa_next; 265 *ifap1 = ifa->ifa_next;
259 266
260 rtmsg_ifa(RTM_DELADDR, ifa); 267 rtmsg_ifa(RTM_DELADDR, ifa);
@@ -283,18 +290,31 @@ static void inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap,
283 */ 290 */
284 rtmsg_ifa(RTM_DELADDR, ifa1); 291 rtmsg_ifa(RTM_DELADDR, ifa1);
285 notifier_call_chain(&inetaddr_chain, NETDEV_DOWN, ifa1); 292 notifier_call_chain(&inetaddr_chain, NETDEV_DOWN, ifa1);
286 if (destroy) {
287 inet_free_ifa(ifa1);
288 293
289 if (!in_dev->ifa_list) 294 if (promote) {
290 inetdev_destroy(in_dev); 295
291 } 296 if (prev_prom) {
297 prev_prom->ifa_next = promote->ifa_next;
298 promote->ifa_next = last_prim->ifa_next;
299 last_prim->ifa_next = promote;
300 }
292 301
293 if (promote && IN_DEV_PROMOTE_SECONDARIES(in_dev)) {
294 /* not sure if we should send a delete notify first? */
295 promote->ifa_flags &= ~IFA_F_SECONDARY; 302 promote->ifa_flags &= ~IFA_F_SECONDARY;
296 rtmsg_ifa(RTM_NEWADDR, promote); 303 rtmsg_ifa(RTM_NEWADDR, promote);
297 notifier_call_chain(&inetaddr_chain, NETDEV_UP, promote); 304 notifier_call_chain(&inetaddr_chain, NETDEV_UP, promote);
305 for (ifa = promote->ifa_next; ifa; ifa = ifa->ifa_next) {
306 if (ifa1->ifa_mask != ifa->ifa_mask ||
307 !inet_ifa_match(ifa1->ifa_address, ifa))
308 continue;
309 fib_add_ifaddr(ifa);
310 }
311
312 }
313 if (destroy) {
314 inet_free_ifa(ifa1);
315
316 if (!in_dev->ifa_list)
317 inetdev_destroy(in_dev);
298 } 318 }
299} 319}
300 320
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 2267c1fad879..882f88f6d13b 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -407,7 +407,7 @@ static void fib_magic(int cmd, int type, u32 dst, int dst_len, struct in_ifaddr
407 tb->tb_delete(tb, &req.rtm, &rta, &req.nlh, NULL); 407 tb->tb_delete(tb, &req.rtm, &rta, &req.nlh, NULL);
408} 408}
409 409
410static void fib_add_ifaddr(struct in_ifaddr *ifa) 410void fib_add_ifaddr(struct in_ifaddr *ifa)
411{ 411{
412 struct in_device *in_dev = ifa->ifa_dev; 412 struct in_device *in_dev = ifa->ifa_dev;
413 struct net_device *dev = in_dev->dev; 413 struct net_device *dev = in_dev->dev;
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 66247f38b371..705e3ce86df9 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -2378,6 +2378,7 @@ static unsigned fib_flag_trans(int type, u32 mask, const struct fib_info *fi)
2378 */ 2378 */
2379static int fib_route_seq_show(struct seq_file *seq, void *v) 2379static int fib_route_seq_show(struct seq_file *seq, void *v)
2380{ 2380{
2381 const struct fib_trie_iter *iter = seq->private;
2381 struct leaf *l = v; 2382 struct leaf *l = v;
2382 int i; 2383 int i;
2383 char bf[128]; 2384 char bf[128];
@@ -2389,6 +2390,8 @@ static int fib_route_seq_show(struct seq_file *seq, void *v)
2389 return 0; 2390 return 0;
2390 } 2391 }
2391 2392
2393 if (iter->trie == trie_local)
2394 return 0;
2392 if (IS_TNODE(l)) 2395 if (IS_TNODE(l))
2393 return 0; 2396 return 0;
2394 2397
diff --git a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig
index 9d3c8b5f327e..0bc00528d888 100644
--- a/net/ipv4/netfilter/Kconfig
+++ b/net/ipv4/netfilter/Kconfig
@@ -440,7 +440,7 @@ config IP_NF_MATCH_COMMENT
440config IP_NF_MATCH_CONNMARK 440config IP_NF_MATCH_CONNMARK
441 tristate 'Connection mark match support' 441 tristate 'Connection mark match support'
442 depends on IP_NF_IPTABLES 442 depends on IP_NF_IPTABLES
443 depends on IP_NF_CONNTRACK_MARK || (NF_CONNTRACK_MARK && NF_CONNTRACK_IPV4) 443 depends on (IP_NF_CONNTRACK && IP_NF_CONNTRACK_MARK) || (NF_CONNTRACK_MARK && NF_CONNTRACK_IPV4)
444 help 444 help
445 This option adds a `connmark' match, which allows you to match the 445 This option adds a `connmark' match, which allows you to match the
446 connection mark value previously set for the session by `CONNMARK'. 446 connection mark value previously set for the session by `CONNMARK'.
@@ -452,7 +452,7 @@ config IP_NF_MATCH_CONNMARK
452config IP_NF_MATCH_CONNBYTES 452config IP_NF_MATCH_CONNBYTES
453 tristate 'Connection byte/packet counter match support' 453 tristate 'Connection byte/packet counter match support'
454 depends on IP_NF_IPTABLES 454 depends on IP_NF_IPTABLES
455 depends on IP_NF_CT_ACCT || (NF_CT_ACCT && NF_CONNTRACK_IPV4) 455 depends on (IP_NF_CONNTRACK && IP_NF_CT_ACCT) || (NF_CT_ACCT && NF_CONNTRACK_IPV4)
456 help 456 help
457 This option adds a `connbytes' match, which allows you to match the 457 This option adds a `connbytes' match, which allows you to match the
458 number of bytes and/or packets for each direction within a connection. 458 number of bytes and/or packets for each direction within a connection.
@@ -767,7 +767,7 @@ config IP_NF_TARGET_TTL
767config IP_NF_TARGET_CONNMARK 767config IP_NF_TARGET_CONNMARK
768 tristate 'CONNMARK target support' 768 tristate 'CONNMARK target support'
769 depends on IP_NF_MANGLE 769 depends on IP_NF_MANGLE
770 depends on IP_NF_CONNTRACK_MARK || (NF_CONNTRACK_MARK && NF_CONNTRACK_IPV4) 770 depends on (IP_NF_CONNTRACK && IP_NF_CONNTRACK_MARK) || (NF_CONNTRACK_MARK && NF_CONNTRACK_IPV4)
771 help 771 help
772 This option adds a `CONNMARK' target, which allows one to manipulate 772 This option adds a `CONNMARK' target, which allows one to manipulate
773 the connection mark value. Similar to the MARK target, but 773 the connection mark value. Similar to the MARK target, but
@@ -779,8 +779,8 @@ config IP_NF_TARGET_CONNMARK
779 779
780config IP_NF_TARGET_CLUSTERIP 780config IP_NF_TARGET_CLUSTERIP
781 tristate "CLUSTERIP target support (EXPERIMENTAL)" 781 tristate "CLUSTERIP target support (EXPERIMENTAL)"
782 depends on IP_NF_IPTABLES && EXPERIMENTAL 782 depends on IP_NF_MANGLE && EXPERIMENTAL
783 depends on IP_NF_CONNTRACK_MARK || (NF_CONNTRACK_MARK && NF_CONNTRACK_IPV4) 783 depends on (IP_NF_CONNTRACK && IP_NF_CONNTRACK_MARK) || (NF_CONNTRACK_MARK && NF_CONNTRACK_IPV4)
784 help 784 help
785 The CLUSTERIP target allows you to build load-balancing clusters of 785 The CLUSTERIP target allows you to build load-balancing clusters of
786 network servers without having a dedicated load-balancing 786 network servers without having a dedicated load-balancing
diff --git a/net/ipv4/netfilter/ip_conntrack_netlink.c b/net/ipv4/netfilter/ip_conntrack_netlink.c
index de9f4464438d..3fce91bcc0ba 100644
--- a/net/ipv4/netfilter/ip_conntrack_netlink.c
+++ b/net/ipv4/netfilter/ip_conntrack_netlink.c
@@ -27,6 +27,7 @@
27#include <linux/errno.h> 27#include <linux/errno.h>
28#include <linux/netlink.h> 28#include <linux/netlink.h>
29#include <linux/spinlock.h> 29#include <linux/spinlock.h>
30#include <linux/interrupt.h>
30#include <linux/notifier.h> 31#include <linux/notifier.h>
31 32
32#include <linux/netfilter.h> 33#include <linux/netfilter.h>
@@ -59,11 +60,13 @@ ctnetlink_dump_tuples_proto(struct sk_buff *skb,
59 60
60 NFA_PUT(skb, CTA_PROTO_NUM, sizeof(u_int8_t), &tuple->dst.protonum); 61 NFA_PUT(skb, CTA_PROTO_NUM, sizeof(u_int8_t), &tuple->dst.protonum);
61 62
63 /* If no protocol helper is found, this function will return the
64 * generic protocol helper, so proto won't *ever* be NULL */
62 proto = ip_conntrack_proto_find_get(tuple->dst.protonum); 65 proto = ip_conntrack_proto_find_get(tuple->dst.protonum);
63 if (likely(proto && proto->tuple_to_nfattr)) { 66 if (likely(proto->tuple_to_nfattr))
64 ret = proto->tuple_to_nfattr(skb, tuple); 67 ret = proto->tuple_to_nfattr(skb, tuple);
65 ip_conntrack_proto_put(proto); 68
66 } 69 ip_conntrack_proto_put(proto);
67 70
68 return ret; 71 return ret;
69 72
@@ -128,9 +131,11 @@ ctnetlink_dump_protoinfo(struct sk_buff *skb, const struct ip_conntrack *ct)
128 131
129 struct nfattr *nest_proto; 132 struct nfattr *nest_proto;
130 int ret; 133 int ret;
131 134
132 if (!proto || !proto->to_nfattr) 135 if (!proto->to_nfattr) {
136 ip_conntrack_proto_put(proto);
133 return 0; 137 return 0;
138 }
134 139
135 nest_proto = NFA_NEST(skb, CTA_PROTOINFO); 140 nest_proto = NFA_NEST(skb, CTA_PROTOINFO);
136 141
@@ -527,10 +532,10 @@ ctnetlink_parse_tuple_proto(struct nfattr *attr,
527 532
528 proto = ip_conntrack_proto_find_get(tuple->dst.protonum); 533 proto = ip_conntrack_proto_find_get(tuple->dst.protonum);
529 534
530 if (likely(proto && proto->nfattr_to_tuple)) { 535 if (likely(proto->nfattr_to_tuple))
531 ret = proto->nfattr_to_tuple(tb, tuple); 536 ret = proto->nfattr_to_tuple(tb, tuple);
532 ip_conntrack_proto_put(proto); 537
533 } 538 ip_conntrack_proto_put(proto);
534 539
535 return ret; 540 return ret;
536} 541}
@@ -596,8 +601,6 @@ static int ctnetlink_parse_nat_proto(struct nfattr *attr,
596 return -EINVAL; 601 return -EINVAL;
597 602
598 npt = ip_nat_proto_find_get(ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum); 603 npt = ip_nat_proto_find_get(ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum);
599 if (!npt)
600 return 0;
601 604
602 if (!npt->nfattr_to_range) { 605 if (!npt->nfattr_to_range) {
603 ip_nat_proto_put(npt); 606 ip_nat_proto_put(npt);
@@ -957,8 +960,6 @@ ctnetlink_change_protoinfo(struct ip_conntrack *ct, struct nfattr *cda[])
957 nfattr_parse_nested(tb, CTA_PROTOINFO_MAX, attr); 960 nfattr_parse_nested(tb, CTA_PROTOINFO_MAX, attr);
958 961
959 proto = ip_conntrack_proto_find_get(npt); 962 proto = ip_conntrack_proto_find_get(npt);
960 if (!proto)
961 return -EINVAL;
962 963
963 if (proto->from_nfattr) 964 if (proto->from_nfattr)
964 err = proto->from_nfattr(tb, ct); 965 err = proto->from_nfattr(tb, ct);
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 56a09a4ac410..a16064ba0caf 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2627,7 +2627,7 @@ static void addrconf_verify(unsigned long foo)
2627 for (i=0; i < IN6_ADDR_HSIZE; i++) { 2627 for (i=0; i < IN6_ADDR_HSIZE; i++) {
2628 2628
2629restart: 2629restart:
2630 write_lock(&addrconf_hash_lock); 2630 read_lock(&addrconf_hash_lock);
2631 for (ifp=inet6_addr_lst[i]; ifp; ifp=ifp->lst_next) { 2631 for (ifp=inet6_addr_lst[i]; ifp; ifp=ifp->lst_next) {
2632 unsigned long age; 2632 unsigned long age;
2633#ifdef CONFIG_IPV6_PRIVACY 2633#ifdef CONFIG_IPV6_PRIVACY
@@ -2649,7 +2649,7 @@ restart:
2649 if (age >= ifp->valid_lft) { 2649 if (age >= ifp->valid_lft) {
2650 spin_unlock(&ifp->lock); 2650 spin_unlock(&ifp->lock);
2651 in6_ifa_hold(ifp); 2651 in6_ifa_hold(ifp);
2652 write_unlock(&addrconf_hash_lock); 2652 read_unlock(&addrconf_hash_lock);
2653 ipv6_del_addr(ifp); 2653 ipv6_del_addr(ifp);
2654 goto restart; 2654 goto restart;
2655 } else if (age >= ifp->prefered_lft) { 2655 } else if (age >= ifp->prefered_lft) {
@@ -2668,7 +2668,7 @@ restart:
2668 2668
2669 if (deprecate) { 2669 if (deprecate) {
2670 in6_ifa_hold(ifp); 2670 in6_ifa_hold(ifp);
2671 write_unlock(&addrconf_hash_lock); 2671 read_unlock(&addrconf_hash_lock);
2672 2672
2673 ipv6_ifa_notify(0, ifp); 2673 ipv6_ifa_notify(0, ifp);
2674 in6_ifa_put(ifp); 2674 in6_ifa_put(ifp);
@@ -2686,7 +2686,7 @@ restart:
2686 in6_ifa_hold(ifp); 2686 in6_ifa_hold(ifp);
2687 in6_ifa_hold(ifpub); 2687 in6_ifa_hold(ifpub);
2688 spin_unlock(&ifp->lock); 2688 spin_unlock(&ifp->lock);
2689 write_unlock(&addrconf_hash_lock); 2689 read_unlock(&addrconf_hash_lock);
2690 ipv6_create_tempaddr(ifpub, ifp); 2690 ipv6_create_tempaddr(ifpub, ifp);
2691 in6_ifa_put(ifpub); 2691 in6_ifa_put(ifpub);
2692 in6_ifa_put(ifp); 2692 in6_ifa_put(ifp);
@@ -2703,7 +2703,7 @@ restart:
2703 spin_unlock(&ifp->lock); 2703 spin_unlock(&ifp->lock);
2704 } 2704 }
2705 } 2705 }
2706 write_unlock(&addrconf_hash_lock); 2706 read_unlock(&addrconf_hash_lock);
2707 } 2707 }
2708 2708
2709 addr_chk_timer.expires = time_before(next, jiffies + HZ) ? jiffies + HZ : next; 2709 addr_chk_timer.expires = time_before(next, jiffies + HZ) ? jiffies + HZ : next;
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index cc518405b3e1..c4a3a993acb7 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -437,7 +437,7 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb)
437 break; 437 break;
438 case IPPROTO_AH: 438 case IPPROTO_AH:
439 nexthdr = ptr[0]; 439 nexthdr = ptr[0];
440 len = (ptr[1] + 1) << 2; 440 len = (ptr[1] + 2) << 2;
441 break; 441 break;
442 default: 442 default:
443 nexthdr = ptr[0]; 443 nexthdr = ptr[0];
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index 922549581abc..be6faf311387 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -628,6 +628,7 @@ ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt,
628 if (!tot_len) 628 if (!tot_len)
629 return NULL; 629 return NULL;
630 630
631 tot_len += sizeof(*opt2);
631 opt2 = sock_kmalloc(sk, tot_len, GFP_ATOMIC); 632 opt2 = sock_kmalloc(sk, tot_len, GFP_ATOMIC);
632 if (!opt2) 633 if (!opt2)
633 return ERR_PTR(-ENOBUFS); 634 return ERR_PTR(-ENOBUFS);
@@ -668,7 +669,26 @@ ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt,
668 669
669 return opt2; 670 return opt2;
670out: 671out:
671 sock_kfree_s(sk, p, tot_len); 672 sock_kfree_s(sk, opt2, opt2->tot_len);
672 return ERR_PTR(err); 673 return ERR_PTR(err);
673} 674}
674 675
676struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
677 struct ipv6_txoptions *opt)
678{
679 /*
680 * ignore the dest before srcrt unless srcrt is being included.
681 * --yoshfuji
682 */
683 if (opt && opt->dst0opt && !opt->srcrt) {
684 if (opt_space != opt) {
685 memcpy(opt_space, opt, sizeof(*opt_space));
686 opt = opt_space;
687 }
688 opt->opt_nflen -= ipv6_optlen(opt->dst0opt);
689 opt->dst0opt = NULL;
690 }
691
692 return opt;
693}
694
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index bbbe80cdaf72..1cf02765fb5c 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -225,20 +225,16 @@ struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions * opt_space,
225 struct ip6_flowlabel * fl, 225 struct ip6_flowlabel * fl,
226 struct ipv6_txoptions * fopt) 226 struct ipv6_txoptions * fopt)
227{ 227{
228 struct ipv6_txoptions * fl_opt = fl ? fl->opt : NULL; 228 struct ipv6_txoptions * fl_opt = fl->opt;
229 229
230 if (fopt == NULL || fopt->opt_flen == 0) { 230 if (fopt == NULL || fopt->opt_flen == 0)
231 if (!fl_opt || !fl_opt->dst0opt || fl_opt->srcrt) 231 return fl_opt;
232 return fl_opt; 232
233 }
234
235 if (fl_opt != NULL) { 233 if (fl_opt != NULL) {
236 opt_space->hopopt = fl_opt->hopopt; 234 opt_space->hopopt = fl_opt->hopopt;
237 opt_space->dst0opt = fl_opt->srcrt ? fl_opt->dst0opt : NULL; 235 opt_space->dst0opt = fl_opt->dst0opt;
238 opt_space->srcrt = fl_opt->srcrt; 236 opt_space->srcrt = fl_opt->srcrt;
239 opt_space->opt_nflen = fl_opt->opt_nflen; 237 opt_space->opt_nflen = fl_opt->opt_nflen;
240 if (fl_opt->dst0opt && !fl_opt->srcrt)
241 opt_space->opt_nflen -= ipv6_optlen(fl_opt->dst0opt);
242 } else { 238 } else {
243 if (fopt->opt_nflen == 0) 239 if (fopt->opt_nflen == 0)
244 return fopt; 240 return fopt;
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 8e9628f1c4c5..a66900cda2af 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -748,7 +748,9 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
748 } 748 }
749 if (opt == NULL) 749 if (opt == NULL)
750 opt = np->opt; 750 opt = np->opt;
751 opt = fl6_merge_options(&opt_space, flowlabel, opt); 751 if (flowlabel)
752 opt = fl6_merge_options(&opt_space, flowlabel, opt);
753 opt = ipv6_fixup_options(&opt_space, opt);
752 754
753 fl.proto = proto; 755 fl.proto = proto;
754 rawv6_probe_proto_opt(&fl, msg); 756 rawv6_probe_proto_opt(&fl, msg);
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index e671153b47b2..5cc8731eb55b 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -771,7 +771,9 @@ do_udp_sendmsg:
771 } 771 }
772 if (opt == NULL) 772 if (opt == NULL)
773 opt = np->opt; 773 opt = np->opt;
774 opt = fl6_merge_options(&opt_space, flowlabel, opt); 774 if (flowlabel)
775 opt = fl6_merge_options(&opt_space, flowlabel, opt);
776 opt = ipv6_fixup_options(&opt_space, opt);
775 777
776 fl->proto = IPPROTO_UDP; 778 fl->proto = IPPROTO_UDP;
777 ipv6_addr_copy(&fl->fl6_dst, daddr); 779 ipv6_addr_copy(&fl->fl6_dst, daddr);
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 8c38ee6d255e..96020d7087e8 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -476,7 +476,7 @@ static int netlink_autobind(struct socket *sock)
476 struct hlist_head *head; 476 struct hlist_head *head;
477 struct sock *osk; 477 struct sock *osk;
478 struct hlist_node *node; 478 struct hlist_node *node;
479 s32 pid = current->pid; 479 s32 pid = current->tgid;
480 int err; 480 int err;
481 static s32 rover = -4097; 481 static s32 rover = -4097;
482 482
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index cdc8d283791c..82fb07aa06a5 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -464,7 +464,7 @@ static int tfifo_enqueue(struct sk_buff *nskb, struct Qdisc *sch)
464 const struct netem_skb_cb *cb 464 const struct netem_skb_cb *cb
465 = (const struct netem_skb_cb *)skb->cb; 465 = (const struct netem_skb_cb *)skb->cb;
466 466
467 if (PSCHED_TLESS(cb->time_to_send, ncb->time_to_send)) 467 if (!PSCHED_TLESS(ncb->time_to_send, cb->time_to_send))
468 break; 468 break;
469 } 469 }
470 470
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 81e00a6c19de..e3b242daf53c 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -39,23 +39,27 @@ static kmem_cache_t *rpc_inode_cachep __read_mostly;
39#define RPC_UPCALL_TIMEOUT (30*HZ) 39#define RPC_UPCALL_TIMEOUT (30*HZ)
40 40
41static void 41static void
42__rpc_purge_upcall(struct inode *inode, int err) 42__rpc_purge_list(struct rpc_inode *rpci, struct list_head *head, int err)
43{ 43{
44 struct rpc_inode *rpci = RPC_I(inode);
45 struct rpc_pipe_msg *msg; 44 struct rpc_pipe_msg *msg;
45 void (*destroy_msg)(struct rpc_pipe_msg *);
46 46
47 while (!list_empty(&rpci->pipe)) { 47 destroy_msg = rpci->ops->destroy_msg;
48 msg = list_entry(rpci->pipe.next, struct rpc_pipe_msg, list); 48 while (!list_empty(head)) {
49 msg = list_entry(head->next, struct rpc_pipe_msg, list);
49 list_del_init(&msg->list); 50 list_del_init(&msg->list);
50 msg->errno = err; 51 msg->errno = err;
51 rpci->ops->destroy_msg(msg); 52 destroy_msg(msg);
52 }
53 while (!list_empty(&rpci->in_upcall)) {
54 msg = list_entry(rpci->pipe.next, struct rpc_pipe_msg, list);
55 list_del_init(&msg->list);
56 msg->errno = err;
57 rpci->ops->destroy_msg(msg);
58 } 53 }
54}
55
56static void
57__rpc_purge_upcall(struct inode *inode, int err)
58{
59 struct rpc_inode *rpci = RPC_I(inode);
60
61 __rpc_purge_list(rpci, &rpci->pipe, err);
62 __rpc_purge_list(rpci, &rpci->in_upcall, err);
59 rpci->pipelen = 0; 63 rpci->pipelen = 0;
60 wake_up(&rpci->waitq); 64 wake_up(&rpci->waitq);
61} 65}