bonding: verify if we still have slaves in bond_3ad_unbind_slave()
authorVeaceslav Falico <vfalico@redhat.com>
Fri, 27 Sep 2013 13:10:58 +0000 (15:10 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 28 Sep 2013 22:27:33 +0000 (15:27 -0700)
After commit 1f718f0f4f97145f4072d2d72dcf85069ca7226d ("bonding: populate
neighbour's private on enslave"), we've moved the unlinking of the slave
to the earliest position possible - so that nobody will see an
half-uninited slave.

However, bond_3ad_unbind_slave() relied that, even while removing the last
slave, it is still accessible - via __get_first_agg() (and, eventually,
bond_first_slave()).

Fix that by verifying if the aggregator return is an actual aggregator, but
not NULL.

CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bonding/bond_3ad.c

index 1337eafe43111a28db6c4c8aadb6138d13e9b86e..2715ea87d64c79abdfa0ed69688630a830ba963d 100644 (file)
@@ -2056,7 +2056,9 @@ void bond_3ad_unbind_slave(struct slave *slave)
                                pr_info("%s: Removing an active aggregator\n",
                                        slave->bond->dev->name);
                                // select new active aggregator
-                               ad_agg_selection_logic(__get_first_agg(port));
+                               temp_aggregator = __get_first_agg(port);
+                               if (temp_aggregator)
+                                       ad_agg_selection_logic(temp_aggregator);
                        }
                }
        }