[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150414152626.GJ7874@acer.localdomain>
Date: Tue, 14 Apr 2015 16:26:27 +0100
From: Patrick McHardy <kaber@...sh.net>
To: Honggang Li <honli@...hat.com>
Cc: roland@...nel.org, sean.hefty@...el.com, hal.rosenstock@...il.com,
davem@...emloft.net, alex.estrin@...el.com, dledford@...hat.com,
edumazet@...gle.com, erezsh@...lanox.com,
nicolas.dichtel@...nd.com, maheshb@...gle.com, jbenc@...hat.com,
ebiederm@...ssion.com, elfring@...rs.sourceforge.net,
f.fainelli@...il.com, linux@...ck-us.net, andrew@...n.ch,
sfeldma@...il.com, alexander.h.duyck@...el.com,
linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org
Subject: Re: [PATCH linux-next 3/4] macvlan: fix possible NULL pointer
dereference in macvlan_dev_get_iflink
On 14.04, Honggang Li wrote:
> Signed-off-by: Honggang Li <honli@...hat.com>
> ---
> drivers/net/macvlan.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
> index b227a13..1e59f39 100644
> --- a/drivers/net/macvlan.c
> +++ b/drivers/net/macvlan.c
> @@ -998,7 +998,9 @@ static int macvlan_dev_get_iflink(const struct net_device *dev)
> {
> struct macvlan_dev *vlan = netdev_priv(dev);
>
> - return vlan->lowerdev->ifindex;
> + if (vlan && vlan->lowerdev)
> + return vlan->lowerdev->ifindex;
That is completely useless. vlan (=netdev_priv) can not be NULL as
netdev_priv() never returns NULL and vlan->lowerdev is always valid
because a macvlan wouldn't make much sense otherwise.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists