Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932826AbbDNPWS (ORCPT ); Tue, 14 Apr 2015 11:22:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57861 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755779AbbDNPVv (ORCPT ); Tue, 14 Apr 2015 11:21:51 -0400 From: Honggang Li To: roland@kernel.org, sean.hefty@intel.com, hal.rosenstock@gmail.com, kaber@trash.net, davem@davemloft.net, alex.estrin@intel.com, dledford@redhat.com, edumazet@google.com, erezsh@mellanox.com, nicolas.dichtel@6wind.com, maheshb@google.com, jbenc@redhat.com, ebiederm@xmission.com, elfring@users.sourceforge.net, f.fainelli@gmail.com, linux@roeck-us.net, andrew@lunn.ch, sfeldma@gmail.com, alexander.h.duyck@intel.com, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Honggang Li Subject: [PATCH linux-next 2/4] ipvlan: fix possible NULL pointer dereference in ipvlan_get_iflink Date: Tue, 14 Apr 2015 23:20:15 +0800 Message-Id: <1429024817-21561-3-git-send-email-honli@redhat.com> In-Reply-To: <1429024817-21561-1-git-send-email-honli@redhat.com> References: <1429024817-21561-1-git-send-email-honli@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 907 Lines: 29 Signed-off-by: Honggang Li --- drivers/net/ipvlan/ipvlan_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c index 77b92a0..479fcf7 100644 --- a/drivers/net/ipvlan/ipvlan_main.c +++ b/drivers/net/ipvlan/ipvlan_main.c @@ -308,7 +308,10 @@ static int ipvlan_get_iflink(const struct net_device *dev) { struct ipvl_dev *ipvlan = netdev_priv(dev); - return ipvlan->phy_dev->ifindex; + if (ipvlan && pvlan->phy_dev) + return ipvlan->phy_dev->ifindex; + else + return 0; } static const struct net_device_ops ipvlan_netdev_ops = { -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/