net/bonding: Destroy bonding master when last slave is gone
authorMoni Shoua <monis@voltaire.com>
Wed, 10 Oct 2007 02:43:43 +0000 (19:43 -0700)
committerJeff Garzik <jeff@garzik.org>
Mon, 15 Oct 2007 18:20:46 +0000 (14:20 -0400)
commitd90a162a4ee280201e84944a84f86d6728dc0c27
treeeff59bda3c6fcec2556b7d80838979e6fe705a43
parent1053f62c24faa6d4ee6f5bfddeca847b84f67a95
net/bonding: Destroy bonding master when last slave is gone

When bonding enslaves non Ethernet devices it takes pointers to functions
in the module that owns the slaves. In this case it becomes unsafe
to keep the bonding master registered after last slave was unenslaved
because we don't know if the pointers are still valid.  Destroying the bond when slave_cnt is zero
ensures that these functions be used anymore.

Signed-off-by: Moni Shoua <monis at voltaire.com>
Acked-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/net/bonding/bond_main.c
drivers/net/bonding/bond_sysfs.c
drivers/net/bonding/bonding.h