From: Jiri Slaby <jirislaby@gmail.com>
To: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
fubar@us.ibm.com, bonding-devel@lists.sourceforge.net,
LKML <linux-kernel@vger.kernel.org>
Subject: bonding: potential null dereference?
Date: Fri, 08 Jan 2010 11:16:38 +0100 [thread overview]
Message-ID: <4B470606.7090409@gmail.com> (raw)
Hi,
I'm looking at Stanse errors and it detected a suspected behaviour in
bonding. In bond_slave_netdev_event, bond_dev is passed down to
netdev_priv, but due to 'if (bond_dev)' test later, it deduced it can be
also NULL.
I can see, that passing NULL to netdev_priv is OK nowadays, as it just
returns NULL + some offset. But what if this changes in the future?
I would bake a patch, but I don't know if bond_dev may be NULL at all
(i.e. superfluous test) or may not (wrong netdev_priv(bond_dev)).
static int (unsigned long event,
struct net_device *slave_dev)
{
struct net_device *bond_dev = slave_dev->master;
struct bonding *bond = netdev_priv(bond_dev);
switch (event) {
case NETDEV_UNREGISTER:
if (bond_dev) {
if (bond->setup_by_slave)
bond_release_and_destroy(bond_dev,
slave_dev);
else
bond_release(bond_dev, slave_dev);
}
break;
--
js
next reply other threads:[~2010-01-08 10:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-08 10:16 Jiri Slaby [this message]
2010-01-08 17:46 ` bonding: potential null dereference? Jay Vosburgh
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=4B470606.7090409@gmail.com \
--to=jirislaby@gmail.com \
--cc=bonding-devel@lists.sourceforge.net \
--cc=davem@davemloft.net \
--cc=fubar@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.