netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] netfilter: use skb_to_full_sk in ip6_route_me_harder
  2018-02-25 19:43 [PATCH] netfilter: use skb_to_full_sk in ip6_route_me_harder Eric Dumazet
@ 2018-02-25 19:41 ` Florian Westphal
  2018-02-25 19:47 ` Eric Dumazet
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Florian Westphal @ 2018-02-25 19:41 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Pablo Neira Ayuso, Florian Westphal, netdev

Eric Dumazet <eric.dumazet@gmail.com> wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> 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")

Indeed, sorry about that, thanks for taking care of this.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] netfilter: use skb_to_full_sk in ip6_route_me_harder
@ 2018-02-25 19:43 Eric Dumazet
  2018-02-25 19:41 ` Florian Westphal
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Eric Dumazet @ 2018-02-25 19:43 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Florian Westphal; +Cc: netdev

From: Eric Dumazet <edumazet@google.com>

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>
---
 net/ipv6/netfilter.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c
index
d95ceca7ff8f648ff301d91a2e3eb60fc2050f1c..531d6957af36c4af48176f9360e9d
95f78a45d55 100644
--- a/net/ipv6/netfilter.c
+++ b/net/ipv6/netfilter.c
@@ -21,18 +21,19 @@
 int ip6_route_me_harder(struct net *net, struct sk_buff *skb)
 {
 	const struct ipv6hdr *iph = ipv6_hdr(skb);
+	struct sock *sk = sk_to_full_sk(skb->sk);
 	unsigned int hh_len;
 	struct dst_entry *dst;
 	struct flowi6 fl6 = {
-		.flowi6_oif = skb->sk ? skb->sk->sk_bound_dev_if : 0,
+		.flowi6_oif = sk ? sk->sk_bound_dev_if : 0,
 		.flowi6_mark = skb->mark,
-		.flowi6_uid = sock_net_uid(net, skb->sk),
+		.flowi6_uid = sock_net_uid(net, sk),
 		.daddr = iph->daddr,
 		.saddr = iph->saddr,
 	};
 	int err;
 
-	dst = ip6_route_output(net, skb->sk, &fl6);
+	dst = ip6_route_output(net, sk, &fl6);
 	err = dst->error;
 	if (err) {
 		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)
 	if (!(IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) &&
 	    xfrm_decode_session(skb, flowi6_to_flowi(&fl6), AF_INET6)
== 0) {
 		skb_dst_set(skb, NULL);
-		dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6),
skb->sk, 0);
+		dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), sk,
0);
 		if (IS_ERR(dst))
 			return PTR_ERR(dst);
 		skb_dst_set(skb, dst);

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] netfilter: use skb_to_full_sk in ip6_route_me_harder
  2018-02-25 19:43 [PATCH] netfilter: use skb_to_full_sk in ip6_route_me_harder Eric Dumazet
  2018-02-25 19:41 ` Florian Westphal
@ 2018-02-25 19:47 ` Eric Dumazet
  2018-02-25 19:48   ` Eric Dumazet
  2018-02-25 19:47 ` Pablo Neira Ayuso
  2018-02-25 19:49 ` [PATCH v2] " Eric Dumazet
  3 siblings, 1 reply; 7+ messages in thread
From: Eric Dumazet @ 2018-02-25 19:47 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Florian Westphal; +Cc: netdev

On Sun, 2018-02-25 at 11:43 -0800, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> 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>
> ---
>  net/ipv6/netfilter.c |    9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c
> index
> d95ceca7ff8f648ff301d91a2e3eb60fc2050f1c..531d6957af36c4af48176f9360e9d
> 95f78a45d55 100644
> --- a/net/ipv6/netfilter.c
> +++ b/net/ipv6/netfilter.c
> @@ -21,18 +21,19 @@
>  int ip6_route_me_harder(struct net *net, struct sk_buff *skb)
>  {
>  	const struct ipv6hdr *iph = ipv6_hdr(skb);
> +	struct sock *sk = sk_to_full_sk(skb->sk);
>  	unsigned int hh_len;
>  	struct dst_entry *dst;
>  	struct flowi6 fl6 = {
> -		.flowi6_oif = skb->sk ? skb->sk->sk_bound_dev_if : 0,
> +		.flowi6_oif = sk ? sk->sk_bound_dev_if : 0,
>  		.flowi6_mark = skb->mark,
> -		.flowi6_uid = sock_net_uid(net, skb->sk),
> +		.flowi6_uid = sock_net_uid(net, sk),
>  		.daddr = iph->daddr,
>  		.saddr = iph->saddr,
>  	};
>  	int err;
>  
> -	dst = ip6_route_output(net, skb->sk, &fl6);
> +	dst = ip6_route_output(net, sk, &fl6);
>  	err = dst->error;
>  	if (err) {
>  		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)
>  	if (!(IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) &&
>  	    xfrm_decode_session(skb, flowi6_to_flowi(&fl6), AF_INET6)
> == 0) {
>  		skb_dst_set(skb, NULL);
> -		dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6),
> skb->sk, 0);
> +		dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), sk,
> 0);
>  		if (IS_ERR(dst))
>  			return PTR_ERR(dst);
>  		skb_dst_set(skb, dst);


No idea what happened, but it looks like this garbage should not affect
   patchwork.

Tell me if a resend is needed, thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] netfilter: use skb_to_full_sk in ip6_route_me_harder
  2018-02-25 19:43 [PATCH] netfilter: use skb_to_full_sk in ip6_route_me_harder Eric Dumazet
  2018-02-25 19:41 ` Florian Westphal
  2018-02-25 19:47 ` Eric Dumazet
@ 2018-02-25 19:47 ` Pablo Neira Ayuso
  2018-02-25 19:49 ` [PATCH v2] " Eric Dumazet
  3 siblings, 0 replies; 7+ messages in thread
From: Pablo Neira Ayuso @ 2018-02-25 19:47 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Florian Westphal, netdev

On Sun, Feb 25, 2018 at 11:43:39AM -0800, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> 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")

Applied, thanks Eric.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] netfilter: use skb_to_full_sk in ip6_route_me_harder
  2018-02-25 19:47 ` Eric Dumazet
@ 2018-02-25 19:48   ` Eric Dumazet
  0 siblings, 0 replies; 7+ messages in thread
From: Eric Dumazet @ 2018-02-25 19:48 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Florian Westphal; +Cc: netdev

On Sun, 2018-02-25 at 11:47 -0800, Eric Dumazet wrote:
> 
> 
> No idea what happened, but it looks like this garbage should not affect
>    patchwork.
> 
> Tell me if a resend is needed, thanks.


Hmm... I will send a V2, sorry for this mess.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2] netfilter: use skb_to_full_sk in ip6_route_me_harder
  2018-02-25 19:43 [PATCH] netfilter: use skb_to_full_sk in ip6_route_me_harder Eric Dumazet
                   ` (2 preceding siblings ...)
  2018-02-25 19:47 ` Pablo Neira Ayuso
@ 2018-02-25 19:49 ` Eric Dumazet
  2018-02-25 19:51   ` Pablo Neira Ayuso
  3 siblings, 1 reply; 7+ messages in thread
From: Eric Dumazet @ 2018-02-25 19:49 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Florian Westphal; +Cc: netdev

From: Eric Dumazet <edumazet@google.com>

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>
---
 net/ipv6/netfilter.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)


diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c
index d95ceca7ff8f648ff301d91a2e3eb60fc2050f1c..531d6957af36c4af48176f9360e9d95f78a45d55 100644
--- a/net/ipv6/netfilter.c
+++ b/net/ipv6/netfilter.c
@@ -21,18 +21,19 @@
 int ip6_route_me_harder(struct net *net, struct sk_buff *skb)
 {
 	const struct ipv6hdr *iph = ipv6_hdr(skb);
+	struct sock *sk = sk_to_full_sk(skb->sk);
 	unsigned int hh_len;
 	struct dst_entry *dst;
 	struct flowi6 fl6 = {
-		.flowi6_oif = skb->sk ? skb->sk->sk_bound_dev_if : 0,
+		.flowi6_oif = sk ? sk->sk_bound_dev_if : 0,
 		.flowi6_mark = skb->mark,
-		.flowi6_uid = sock_net_uid(net, skb->sk),
+		.flowi6_uid = sock_net_uid(net, sk),
 		.daddr = iph->daddr,
 		.saddr = iph->saddr,
 	};
 	int err;
 
-	dst = ip6_route_output(net, skb->sk, &fl6);
+	dst = ip6_route_output(net, sk, &fl6);
 	err = dst->error;
 	if (err) {
 		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)
 	if (!(IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) &&
 	    xfrm_decode_session(skb, flowi6_to_flowi(&fl6), AF_INET6) == 0) {
 		skb_dst_set(skb, NULL);
-		dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), skb->sk, 0);
+		dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), sk, 0);
 		if (IS_ERR(dst))
 			return PTR_ERR(dst);
 		skb_dst_set(skb, dst);

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] netfilter: use skb_to_full_sk in ip6_route_me_harder
  2018-02-25 19:49 ` [PATCH v2] " Eric Dumazet
@ 2018-02-25 19:51   ` Pablo Neira Ayuso
  0 siblings, 0 replies; 7+ messages in thread
From: Pablo Neira Ayuso @ 2018-02-25 19:51 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Florian Westphal, netdev

On Sun, Feb 25, 2018 at 11:49:07AM -0800, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> 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")

Applied this one, thanks Eric.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-02-25 19:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-25 19:43 [PATCH] netfilter: use skb_to_full_sk in ip6_route_me_harder Eric Dumazet
2018-02-25 19:41 ` Florian Westphal
2018-02-25 19:47 ` Eric Dumazet
2018-02-25 19:48   ` Eric Dumazet
2018-02-25 19:47 ` Pablo Neira Ayuso
2018-02-25 19:49 ` [PATCH v2] " Eric Dumazet
2018-02-25 19:51   ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).