aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-11-21 13:46:34 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-21 13:46:34 -0500
commit1a324727caa26cd65a359a958c90fbd251d4aa49 (patch)
tree543a4f413c1c99f4b5be0b3c5f3744c9e4581db9
parentdb93a82fa9d8b4d6e31c227922eaae829253bb88 (diff)
parent461ddf3b90bb149b99c3f675959c1bd6b11ed936 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
-rw-r--r--Documentation/DocBook/kernel-api.tmpl6
-rw-r--r--fs/compat_ioctl.c8
-rw-r--r--include/linux/netfilter_ipv4/ipt_sctp.h12
-rw-r--r--include/linux/skbuff.h7
-rw-r--r--include/net/ipv6.h2
-rw-r--r--net/core/filter.c6
-rw-r--r--net/dccp/proto.c1
-rw-r--r--net/ipv4/fib_trie.c3
-rw-r--r--net/ipv4/netfilter/Kconfig10
-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/sched/sch_netem.c2
16 files changed, 70 insertions, 45 deletions
diff --git a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl
index 096aed62c326..767433bdbc40 100644
--- a/Documentation/DocBook/kernel-api.tmpl
+++ b/Documentation/DocBook/kernel-api.tmpl
@@ -237,8 +237,10 @@ X!Ilib/string.c
237 <sect1><title>Driver Support</title> 237 <sect1><title>Driver Support</title>
238!Enet/core/dev.c 238!Enet/core/dev.c
239!Enet/ethernet/eth.c 239!Enet/ethernet/eth.c
240!Einclude/linux/etherdevice.h 240!Iinclude/linux/etherdevice.h
241!Enet/core/wireless.c 241<!-- FIXME: Removed for now since no structured comments in source
242X!Enet/core/wireless.c
243-->
242 </sect1> 244 </sect1>
243 <sect1><title>Synchronous PPP</title> 245 <sect1><title>Synchronous PPP</title>
244!Edrivers/net/wan/syncppp.c 246!Edrivers/net/wan/syncppp.c
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 31b7efd94d66..43a2508ac696 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -686,7 +686,8 @@ static int dev_ifconf(unsigned int fd, unsigned int cmd, unsigned long arg)
686 686
687 ifr = ifc.ifc_req; 687 ifr = ifc.ifc_req;
688 ifr32 = compat_ptr(ifc32.ifcbuf); 688 ifr32 = compat_ptr(ifc32.ifcbuf);
689 for (i = 0, j = 0; i < ifc32.ifc_len && j < ifc.ifc_len; 689 for (i = 0, j = 0;
690 i + sizeof (struct ifreq32) < ifc32.ifc_len && j < ifc.ifc_len;
690 i += sizeof (struct ifreq32), j += sizeof (struct ifreq)) { 691 i += sizeof (struct ifreq32), j += sizeof (struct ifreq)) {
691 if (copy_in_user(ifr32, ifr, sizeof (struct ifreq32))) 692 if (copy_in_user(ifr32, ifr, sizeof (struct ifreq32)))
692 return -EFAULT; 693 return -EFAULT;
@@ -702,10 +703,7 @@ static int dev_ifconf(unsigned int fd, unsigned int cmd, unsigned long arg)
702 i = ((i / sizeof(struct ifreq)) * sizeof(struct ifreq32)); 703 i = ((i / sizeof(struct ifreq)) * sizeof(struct ifreq32));
703 ifc32.ifc_len = i; 704 ifc32.ifc_len = i;
704 } else { 705 } else {
705 if (i <= ifc32.ifc_len) 706 ifc32.ifc_len = i;
706 ifc32.ifc_len = i;
707 else
708 ifc32.ifc_len = i - sizeof (struct ifreq32);
709 } 707 }
710 if (copy_to_user(compat_ptr(arg), &ifc32, sizeof(struct ifconf32))) 708 if (copy_to_user(compat_ptr(arg), &ifc32, sizeof(struct ifconf32)))
711 return -EFAULT; 709 return -EFAULT;
diff --git a/include/linux/netfilter_ipv4/ipt_sctp.h b/include/linux/netfilter_ipv4/ipt_sctp.h
index e93a9ec99fc2..80b3dbacd193 100644
--- a/include/linux/netfilter_ipv4/ipt_sctp.h
+++ b/include/linux/netfilter_ipv4/ipt_sctp.h
@@ -7,8 +7,6 @@
7 7
8#define IPT_SCTP_VALID_FLAGS 0x07 8#define IPT_SCTP_VALID_FLAGS 0x07
9 9
10#define ELEMCOUNT(x) (sizeof(x)/sizeof(x[0]))
11
12 10
13struct ipt_sctp_flag_info { 11struct ipt_sctp_flag_info {
14 u_int8_t chunktype; 12 u_int8_t chunktype;
@@ -59,21 +57,21 @@ struct ipt_sctp_info {
59#define SCTP_CHUNKMAP_RESET(chunkmap) \ 57#define SCTP_CHUNKMAP_RESET(chunkmap) \
60 do { \ 58 do { \
61 int i; \ 59 int i; \
62 for (i = 0; i < ELEMCOUNT(chunkmap); i++) \ 60 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \
63 chunkmap[i] = 0; \ 61 chunkmap[i] = 0; \
64 } while (0) 62 } while (0)
65 63
66#define SCTP_CHUNKMAP_SET_ALL(chunkmap) \ 64#define SCTP_CHUNKMAP_SET_ALL(chunkmap) \
67 do { \ 65 do { \
68 int i; \ 66 int i; \
69 for (i = 0; i < ELEMCOUNT(chunkmap); i++) \ 67 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \
70 chunkmap[i] = ~0; \ 68 chunkmap[i] = ~0; \
71 } while (0) 69 } while (0)
72 70
73#define SCTP_CHUNKMAP_COPY(destmap, srcmap) \ 71#define SCTP_CHUNKMAP_COPY(destmap, srcmap) \
74 do { \ 72 do { \
75 int i; \ 73 int i; \
76 for (i = 0; i < ELEMCOUNT(chunkmap); i++) \ 74 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \
77 destmap[i] = srcmap[i]; \ 75 destmap[i] = srcmap[i]; \
78 } while (0) 76 } while (0)
79 77
@@ -81,7 +79,7 @@ struct ipt_sctp_info {
81({ \ 79({ \
82 int i; \ 80 int i; \
83 int flag = 1; \ 81 int flag = 1; \
84 for (i = 0; i < ELEMCOUNT(chunkmap); i++) { \ 82 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { \
85 if (chunkmap[i]) { \ 83 if (chunkmap[i]) { \
86 flag = 0; \ 84 flag = 0; \
87 break; \ 85 break; \
@@ -94,7 +92,7 @@ struct ipt_sctp_info {
94({ \ 92({ \
95 int i; \ 93 int i; \
96 int flag = 1; \ 94 int flag = 1; \
97 for (i = 0; i < ELEMCOUNT(chunkmap); i++) { \ 95 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { \
98 if (chunkmap[i] != ~0) { \ 96 if (chunkmap[i] != ~0) { \
99 flag = 0; \ 97 flag = 0; \
100 break; \ 98 break; \
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 0a8ea8b35816..8c5d6001a923 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -206,6 +206,7 @@ enum {
206 * @nfct: Associated connection, if any 206 * @nfct: Associated connection, if any
207 * @ipvs_property: skbuff is owned by ipvs 207 * @ipvs_property: skbuff is owned by ipvs
208 * @nfctinfo: Relationship of this skb to the connection 208 * @nfctinfo: Relationship of this skb to the connection
209 * @nfct_reasm: netfilter conntrack re-assembly pointer
209 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c 210 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c
210 * @tc_index: Traffic control index 211 * @tc_index: Traffic control index
211 * @tc_verd: traffic control verdict 212 * @tc_verd: traffic control verdict
@@ -264,16 +265,14 @@ struct sk_buff {
264 nohdr:1, 265 nohdr:1,
265 nfctinfo:3; 266 nfctinfo:3;
266 __u8 pkt_type:3, 267 __u8 pkt_type:3,
267 fclone:2; 268 fclone:2,
269 ipvs_property:1;
268 __be16 protocol; 270 __be16 protocol;
269 271
270 void (*destructor)(struct sk_buff *skb); 272 void (*destructor)(struct sk_buff *skb);
271#ifdef CONFIG_NETFILTER 273#ifdef CONFIG_NETFILTER
272 __u32 nfmark; 274 __u32 nfmark;
273 struct nf_conntrack *nfct; 275 struct nf_conntrack *nfct;
274#if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE)
275 __u8 ipvs_property:1;
276#endif
277#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 276#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
278 struct sk_buff *nfct_reasm; 277 struct sk_buff *nfct_reasm;
279#endif 278#endif
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 6addb4d464d6..0a2ad51cff82 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -237,6 +237,8 @@ extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct ipv6_t
237 int newtype, 237 int newtype,
238 struct ipv6_opt_hdr __user *newopt, 238 struct ipv6_opt_hdr __user *newopt,
239 int newoptlen); 239 int newoptlen);
240struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
241 struct ipv6_txoptions *opt);
240 242
241extern int ip6_frag_nqueues; 243extern int ip6_frag_nqueues;
242extern atomic_t ip6_frag_mem; 244extern atomic_t ip6_frag_mem;
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/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/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/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