aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2018-02-25 14:49:07 -0500
committerPablo Neira Ayuso <pablo@netfilter.org>2018-02-25 14:51:13 -0500
commit7d98386d55a5afaa65de77e1e9197edeb8a42079 (patch)
tree7af7994cb806d57478f5e376a39c0a001c03b7d7
parent47b7e7f82802dced3ac73658bf4b77584a63063f (diff)
netfilter: use skb_to_full_sk in ip6_route_me_harder
For some reason, Florian forgot to apply to ip6_route_me_harder the fix that went in commit 29e09229d9f2 ("netfilter: use skb_to_full_sk in ip_route_me_harder") Fixes: ca6fb0651883 ("tcp: attach SYNACK messages to request sockets instead of listener")  Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: syzbot <syzkaller@googlegroups.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--net/ipv6/netfilter.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c
index d95ceca7ff8f..531d6957af36 100644
--- a/net/ipv6/netfilter.c
+++ b/net/ipv6/netfilter.c
@@ -21,18 +21,19 @@
21int ip6_route_me_harder(struct net *net, struct sk_buff *skb) 21int ip6_route_me_harder(struct net *net, struct sk_buff *skb)
22{ 22{
23 const struct ipv6hdr *iph = ipv6_hdr(skb); 23 const struct ipv6hdr *iph = ipv6_hdr(skb);
24 struct sock *sk = sk_to_full_sk(skb->sk);
24 unsigned int hh_len; 25 unsigned int hh_len;
25 struct dst_entry *dst; 26 struct dst_entry *dst;
26 struct flowi6 fl6 = { 27 struct flowi6 fl6 = {
27 .flowi6_oif = skb->sk ? skb->sk->sk_bound_dev_if : 0, 28 .flowi6_oif = sk ? sk->sk_bound_dev_if : 0,
28 .flowi6_mark = skb->mark, 29 .flowi6_mark = skb->mark,
29 .flowi6_uid = sock_net_uid(net, skb->sk), 30 .flowi6_uid = sock_net_uid(net, sk),
30 .daddr = iph->daddr, 31 .daddr = iph->daddr,
31 .saddr = iph->saddr, 32 .saddr = iph->saddr,
32 }; 33 };
33 int err; 34 int err;
34 35
35 dst = ip6_route_output(net, skb->sk, &fl6); 36 dst = ip6_route_output(net, sk, &fl6);
36 err = dst->error; 37 err = dst->error;
37 if (err) { 38 if (err) {
38 IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES); 39 IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES);
@@ -50,7 +51,7 @@ int ip6_route_me_harder(struct net *net, struct sk_buff *skb)
50 if (!(IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) && 51 if (!(IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) &&
51 xfrm_decode_session(skb, flowi6_to_flowi(&fl6), AF_INET6) == 0) { 52 xfrm_decode_session(skb, flowi6_to_flowi(&fl6), AF_INET6) == 0) {
52 skb_dst_set(skb, NULL); 53 skb_dst_set(skb, NULL);
53 dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), skb->sk, 0); 54 dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), sk, 0);
54 if (IS_ERR(dst)) 55 if (IS_ERR(dst))
55 return PTR_ERR(dst); 56 return PTR_ERR(dst);
56 skb_dst_set(skb, dst); 57 skb_dst_set(skb, dst);