All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] ip6_gre: fix endianness errors in ip6gre_err
@ 2015-02-04 14:25 Sabrina Dubroca
  2015-02-04 15:44 ` Eric Dumazet
  2015-02-05  8:34 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Sabrina Dubroca @ 2015-02-04 14:25 UTC (permalink / raw)
  To: davem; +Cc: netdev, Sabrina Dubroca

info is in network byte order, change it back to host byte order
before use. In particular, the current code sets the MTU of the tunnel
to a wrong (too big) value.

Fixes: c12b395a4664 ("gre: Support GRE over IPv6")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
---
 net/ipv6/ip6_gre.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 13cda4c6313b..01ccc28a686f 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -417,7 +417,7 @@ static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 		if (code == ICMPV6_HDR_FIELD)
 			teli = ip6_tnl_parse_tlv_enc_lim(skb, skb->data);
 
-		if (teli && teli == info - 2) {
+		if (teli && teli == be32_to_cpu(info) - 2) {
 			tel = (struct ipv6_tlv_tnl_enc_lim *) &skb->data[teli];
 			if (tel->encap_limit == 0) {
 				net_warn_ratelimited("%s: Too small encapsulation limit or routing loop in tunnel!\n",
@@ -429,7 +429,7 @@ static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 		}
 		break;
 	case ICMPV6_PKT_TOOBIG:
-		mtu = info - offset;
+		mtu = be32_to_cpu(info) - offset;
 		if (mtu < IPV6_MIN_MTU)
 			mtu = IPV6_MIN_MTU;
 		t->dev->mtu = mtu;
-- 
2.2.2

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

* Re: [PATCH net] ip6_gre: fix endianness errors in ip6gre_err
  2015-02-04 14:25 [PATCH net] ip6_gre: fix endianness errors in ip6gre_err Sabrina Dubroca
@ 2015-02-04 15:44 ` Eric Dumazet
  2015-02-04 15:50   ` Eric Dumazet
  2015-02-05  8:34 ` David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2015-02-04 15:44 UTC (permalink / raw)
  To: Sabrina Dubroca; +Cc: davem, netdev

On Wed, 2015-02-04 at 15:25 +0100, Sabrina Dubroca wrote:
> info is in network byte order, change it back to host byte order
> before use. In particular, the current code sets the MTU of the tunnel
> to a wrong (too big) value.
> 
> Fixes: c12b395a4664 ("gre: Support GRE over IPv6")
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
> ---

Acked-by: Eric Dumazet <edumazet@google.com>

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

* Re: [PATCH net] ip6_gre: fix endianness errors in ip6gre_err
  2015-02-04 15:44 ` Eric Dumazet
@ 2015-02-04 15:50   ` Eric Dumazet
  2015-02-04 23:38     ` Sabrina Dubroca
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2015-02-04 15:50 UTC (permalink / raw)
  To: Sabrina Dubroca; +Cc: davem, netdev

On Wed, 2015-02-04 at 07:44 -0800, Eric Dumazet wrote:
> On Wed, 2015-02-04 at 15:25 +0100, Sabrina Dubroca wrote:
> > info is in network byte order, change it back to host byte order
> > before use. In particular, the current code sets the MTU of the tunnel
> > to a wrong (too big) value.
> > 
> > Fixes: c12b395a4664 ("gre: Support GRE over IPv6")
> > Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
> > ---
> 
> Acked-by: Eric Dumazet <edumazet@google.com>
> 


BTW, "fl6.flowi6_proto = skb->protocol; " in ip6gre_xmit_other()
looks suspicious...

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

* Re: [PATCH net] ip6_gre: fix endianness errors in ip6gre_err
  2015-02-04 15:50   ` Eric Dumazet
@ 2015-02-04 23:38     ` Sabrina Dubroca
  0 siblings, 0 replies; 5+ messages in thread
From: Sabrina Dubroca @ 2015-02-04 23:38 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: davem, netdev

2015-02-04, 07:50:12 -0800, Eric Dumazet wrote:
> On Wed, 2015-02-04 at 07:44 -0800, Eric Dumazet wrote:
> > On Wed, 2015-02-04 at 15:25 +0100, Sabrina Dubroca wrote:
> > > info is in network byte order, change it back to host byte order
> > > before use. In particular, the current code sets the MTU of the tunnel
> > > to a wrong (too big) value.
> > > 
> > > Fixes: c12b395a4664 ("gre: Support GRE over IPv6")
> > > Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
> > > ---
> > 
> > Acked-by: Eric Dumazet <edumazet@google.com>
> > 
> 
> 
> BTW, "fl6.flowi6_proto = skb->protocol; " in ip6gre_xmit_other()
> looks suspicious...

Yes, I know that sparse complains about it.  I don't know how to
handle that for now.  ntohs would silence the sparse warning, but we
would still have u8 vs u16.  I'll need to have a closer look.

-- 
Sabrina

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

* Re: [PATCH net] ip6_gre: fix endianness errors in ip6gre_err
  2015-02-04 14:25 [PATCH net] ip6_gre: fix endianness errors in ip6gre_err Sabrina Dubroca
  2015-02-04 15:44 ` Eric Dumazet
@ 2015-02-05  8:34 ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2015-02-05  8:34 UTC (permalink / raw)
  To: sd; +Cc: netdev

From: Sabrina Dubroca <sd@queasysnail.net>
Date: Wed,  4 Feb 2015 15:25:09 +0100

> info is in network byte order, change it back to host byte order
> before use. In particular, the current code sets the MTU of the tunnel
> to a wrong (too big) value.
> 
> Fixes: c12b395a4664 ("gre: Support GRE over IPv6")
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>

Applied.

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

end of thread, other threads:[~2015-02-05  8:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-04 14:25 [PATCH net] ip6_gre: fix endianness errors in ip6gre_err Sabrina Dubroca
2015-02-04 15:44 ` Eric Dumazet
2015-02-04 15:50   ` Eric Dumazet
2015-02-04 23:38     ` Sabrina Dubroca
2015-02-05  8:34 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.