[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150414155524.GA18069@roeck-us.net>
Date: Tue, 14 Apr 2015 08:55:24 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Honggang Li <honli@...hat.com>
Cc: roland@...nel.org, sean.hefty@...el.com, hal.rosenstock@...il.com,
kaber@...sh.net, 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, 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 4/4] net/dsa: fix possible NULL pointer
dereference in dsa_slave_get_iflink
On Tue, Apr 14, 2015 at 11:20:17PM +0800, Honggang Li wrote:
> Signed-off-by: Honggang Li <honli@...hat.com>
> ---
> net/dsa/slave.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/net/dsa/slave.c b/net/dsa/slave.c
> index 827cda56..070b599 100644
> --- a/net/dsa/slave.c
> +++ b/net/dsa/slave.c
> @@ -59,7 +59,10 @@ static int dsa_slave_get_iflink(const struct net_device *dev)
> {
> struct dsa_slave_priv *p = netdev_priv(dev);
>
> - return p->parent->dst->master_netdev->ifindex;
> + if (p && p->parent && p->parent->dst && p->parent->dst->master_netdev)
> + return p->parent->dst->master_netdev->ifindex;
> + else
> + return 0;
> }
I would expect some explanation why you believe that any of those pointers
can be NULL.
Guenter
--
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