From: Susant Sahani Subject: [PATCH] ip6_tunnel: fix potential NULL pointer dereference Date: Sat, 10 May 2014 00:11:32 +0530 Message-ID: <1399660892-19008-1-git-send-email-susant@redhat.com> Cc: tgraf@suug.ch To: netdev@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:32687 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750780AbaEIE3O (ORCPT ); Fri, 9 May 2014 00:29:14 -0400 Sender: netdev-owner@vger.kernel.org List-ID: 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 Acked-by: Thomas Graf --- net/ipv6/ip6_tunnel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index b05b609..f6a66bb 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c @@ -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]); -- 1.8.3.1