[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM_iQpX5ySGZqKTsaQO6WHaFLMqG6Q2ZAUT=ctGijL-7KU_1uA@mail.gmail.com>
Date: Fri, 21 Sep 2018 11:51:23 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: Paolo Abeni <pabeni@...hat.com>
Cc: Linux Kernel Network Developers <netdev@...r.kernel.org>,
David Miller <davem@...emloft.net>,
Alexander Potapenko <glider@...gle.com>
Subject: Re: [PATCH net] ip6_tunnel: be careful when accessing the inner header
On Wed, Sep 19, 2018 at 6:04 AM Paolo Abeni <pabeni@...hat.com> wrote:
> diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
> index 419960b0ba16..a0b6932c3afd 100644
> --- a/net/ipv6/ip6_tunnel.c
> +++ b/net/ipv6/ip6_tunnel.c
> @@ -1234,7 +1234,7 @@ static inline int
> ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
> {
> struct ip6_tnl *t = netdev_priv(dev);
> - const struct iphdr *iph = ip_hdr(skb);
> + const struct iphdr *iph;
> int encap_limit = -1;
> struct flowi6 fl6;
> __u8 dsfield;
> @@ -1242,6 +1242,11 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
> u8 tproto;
> int err;
>
> + /* ensure we can access the full inner ip header */
> + if (!pskb_may_pull(skb, sizeof(struct iphdr)))
> + return -1;
> +
> + iph = ip_hdr(skb);
Hmm...
How do IPv4 tunnels ensure they have the right inner header to access?
ip_tunnel_xmit() uses skb_inner_network_header() to access inner header
which doesn't have any check either AFAIK.
Powered by blists - more mailing lists