netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* bonding: potential null dereference?
@ 2010-01-08 10:16 Jiri Slaby
  2010-01-08 17:46 ` Jay Vosburgh
  0 siblings, 1 reply; 2+ messages in thread
From: Jiri Slaby @ 2010-01-08 10:16 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, fubar, bonding-devel, LKML

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-01-08 17:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-08 10:16 bonding: potential null dereference? Jiri Slaby
2010-01-08 17:46 ` Jay Vosburgh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).