From: Honggang LI <honli@redhat.com>
To: Erez Shitrit <erezsh@dev.mellanox.co.il>
Cc: Roland Dreier <roland@kernel.org>,
sean.hefty@intel.com, hal.rosenstock@gmail.com, kaber@trash.net,
davem@davemloft.net, Alex Estrin <alex.estrin@intel.com>,
Doug Ledford <dledford@redhat.com>,
edumazet@google.com, Erez Shitrit <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-rdma@vger.kernel.org>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH linux-next 1/4] infiniband/ipoib: fix possible NULL pointer dereference in ipoib_get_iflink
Date: Wed, 15 Apr 2015 14:57:34 +0800 [thread overview]
Message-ID: <20150415065734.GA2477@honli.nay.redhat.com> (raw)
In-Reply-To: <20150415051640.GB4881@honli.nay.redhat.com>
There was network accident in the office. I can't find this email in
public mailing list. So, I reset it. If you had recived this, please
ignore it.
thanks
On Wed, Apr 15, 2015 at 01:16:40PM +0800, Honggang LI wrote:
> On Tue, Apr 14, 2015 at 07:30:03PM +0300, Erez Shitrit wrote:
> > > @@ -846,7 +846,10 @@ static int ipoib_get_iflink(const struct net_device *dev)
> > > {
> > > struct ipoib_dev_priv *priv = netdev_priv(dev);
> > >
> > > - return priv->parent->ifindex;
> > > + if (priv && priv->parent)
> > > + return priv->parent->ifindex;
> > > + else
> > > + return 0;
> > This will make parent interface to return 0 instead of its own ifindex.
> > I would suggest write something like that:
> >
> > + /* parent interface */
> > + if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags))
> > + return dev->ifindex;
> > +
>
> Hi, Erez
>
> Sorry for delay of reply. It was about 01:00 in the morning, so I
> went into bed. And thank you for the suggestion. You are right. After
> insert some printk statements in the driver, I confirmed it.
>
> ---------------------- console log --------------------
> ipoib_get_iflink: priv = ffff880275e487c0, priv->parent = (null), priv->flags = 0x20f, dev = ffff880275e48000, dev->name = qib_ib1
> qib_ib1, test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags) = 0
> qib_ib1, idev->ifindex = 14
>
> ipoib_get_iflink: priv = ffff8802765d27c0, priv->parent = (null), priv->flags = 0x20f, dev = ffff8802765d2000, dev->name = qib_ib2
> qib_ib2, test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags) = 0
> qib_ib2, idev->ifindex = 15
>
> ipoib_get_iflink: priv = ffff8804741a47c0, priv->parent = ffff880275e48000, priv->flags = 0x224, dev = ffff8804741a4000, dev->name = qib_ib1.8003
> qib_ib1.8003, test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags) = 1
> qib_ib1.8003, idev->ifindex = 16
>
> ---------------------- console log --------------------
>
> I will rewrite the patch.
>
> > + /* child/vlan interface */
> > + if (!priv->parent)
> > + return -1;
> > +
> > return priv->parent->ifindex;
> >
> > Thanks,
> > Erez.
> >
> > > }
> > >
> > > static u32 ipoib_addr_hash(struct ipoib_neigh_hash *htbl, u8 *daddr)
> > > --
> > > 1.8.3.1
> > >
next prev parent reply other threads:[~2015-04-15 6:57 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-14 15:20 [PATCH linux-next 0/4] fix possile NULL pointer dereference in ndo_get_iflink callback functions Honggang Li
2015-04-14 15:20 ` [PATCH linux-next 1/4] infiniband/ipoib: fix possible NULL pointer dereference in ipoib_get_iflink Honggang Li
2015-04-14 15:34 ` Eric Dumazet
2015-04-14 15:44 ` Honggang LI
2015-04-14 15:49 ` Nicolas Dichtel
2015-04-14 15:53 ` Honggang LI
2015-04-14 16:14 ` Eric Dumazet
2015-04-14 16:01 ` Yann Droneaud
2015-04-14 16:44 ` Nicolas Dichtel
2015-04-14 16:30 ` Erez Shitrit
2015-04-14 16:46 ` Nicolas Dichtel
2015-04-14 20:41 ` Jason Gunthorpe
2015-04-15 5:24 ` Or Gerlitz
2015-04-15 6:17 ` Erez Shitrit
2015-04-15 16:06 ` Jason Gunthorpe
2015-04-16 11:27 ` Erez Shitrit
2015-04-15 5:16 ` Honggang LI
2015-04-15 6:57 ` Honggang LI [this message]
2015-04-14 15:20 ` [PATCH linux-next 2/4] ipvlan: fix possible NULL pointer dereference in ipvlan_get_iflink Honggang Li
2015-04-14 15:20 ` [PATCH linux-next 3/4] macvlan: fix possible NULL pointer dereference in macvlan_dev_get_iflink Honggang Li
2015-04-14 15:26 ` Patrick McHardy
2015-04-14 15:32 ` Honggang LI
2015-04-14 15:35 ` Patrick McHardy
2015-04-14 17:47 ` David Miller
2015-04-14 15:35 ` Nicolas Dichtel
2015-04-14 15:37 ` Andrew Lunn
2015-04-14 15:46 ` Honggang LI
2015-04-14 15:20 ` [PATCH linux-next 4/4] net/dsa: fix possible NULL pointer dereference in dsa_slave_get_iflink Honggang Li
2015-04-14 15:55 ` Guenter Roeck
2015-04-14 16:26 ` [PATCH linux-next v2] infiniband/ipoib: fix possible NULL pointer dereference in ipoib_get_iflink Honggang Li
2015-04-14 16:26 ` [PATCH] " Honggang Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150415065734.GA2477@honli.nay.redhat.com \
--to=honli@redhat.com \
--cc=alex.estrin@intel.com \
--cc=alexander.h.duyck@intel.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=dledford@redhat.com \
--cc=ebiederm@xmission.com \
--cc=edumazet@google.com \
--cc=elfring@users.sourceforge.net \
--cc=erezsh@dev.mellanox.co.il \
--cc=erezsh@mellanox.com \
--cc=f.fainelli@gmail.com \
--cc=hal.rosenstock@gmail.com \
--cc=jbenc@redhat.com \
--cc=kaber@trash.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=maheshb@google.com \
--cc=netdev@vger.kernel.org \
--cc=nicolas.dichtel@6wind.com \
--cc=roland@kernel.org \
--cc=sean.hefty@intel.com \
--cc=sfeldma@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox