[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+mtBx_364iHXxLkA=Ytb=34_2zEy9-3hqfOdt96Ckhm8NwFiQ@mail.gmail.com>
Date: Tue, 16 Dec 2014 12:23:24 -0800
From: Tom Herbert <therbert@...gle.com>
To: Thomas Graf <tgraf@...g.ch>
Cc: David Miller <davem@...emloft.net>,
Linux Netdev List <netdev@...r.kernel.org>
Subject: Re: [PATCH 2/2] ip_tunnel: Add missing validation of encap type to ip_tunnel_encap_setup()
On Tue, Dec 16, 2014 at 12:05 PM, Thomas Graf <tgraf@...g.ch> wrote:
> The encap->type comes straight from Netlink. Validate it against
> max supported encap types just like ip_encap_hlen() already does.
>
> Fixes: a8c5f9 ("ip_tunnel: Ops registration for secondary encap (fou, gue)")
> Signed-off-by: Thomas Graf <tgraf@...g.ch>
> ---
> net/ipv4/ip_tunnel.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
> index 2f498f8..d3e4479 100644
> --- a/net/ipv4/ip_tunnel.c
> +++ b/net/ipv4/ip_tunnel.c
> @@ -573,6 +573,9 @@ int ip_tunnel_encap(struct sk_buff *skb, struct ip_tunnel *t,
> if (t->encap.type == TUNNEL_ENCAP_NONE)
> return 0;
>
> + if (t->encap.type >= MAX_IPTUN_ENCAP_OPS)
> + return -EINVAL;
> +
I don't think this is technically needed, we should have already
verified the type when setting up the tunnel (ip_encap_hlen).
> rcu_read_lock();
> ops = rcu_dereference(iptun_encaps[t->encap.type]);
> if (likely(ops && ops->build_header))
> --
> 1.9.3
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists