ip6_tunnel: fix potential NULL pointer dereference
authorSusant Sahani <susant@redhat.com>
Fri, 9 May 2014 18:41:32 +0000 (00:11 +0530)
committerDavid S. Miller <davem@davemloft.net>
Tue, 13 May 2014 04:27:19 +0000 (00:27 -0400)
The function ip6_tnl_validate assumes that the rtnl
attribute IFLA_IPTUN_PROTO always be filled . If this
attribute is not filled by  the userspace application
kernel get crashed with NULL pointer dereference. This
patch fixes the potential kernel crash when
IFLA_IPTUN_PROTO is missing .

Signed-off-by: Susant Sahani <susant@redhat.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/ip6_tunnel.c

index b05b609f69d1cd3e58bd525cb0b5e8b11d429b80..f6a66bb4114db3af0f23ee1f950acf8b9720304d 100644 (file)
@@ -1557,7 +1557,7 @@ static int ip6_tnl_validate(struct nlattr *tb[], struct nlattr *data[])
 {
        u8 proto;
 
-       if (!data)
+       if (!data || !data[IFLA_IPTUN_PROTO])
                return 0;
 
        proto = nla_get_u8(data[IFLA_IPTUN_PROTO]);