Re: [PATCH net-next 1/5] bonding: convert to list API and replace bond's custom list
From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2013-07-31 18:37:21
From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2013-07-31 18:37:21
On Wed, 31 Jul 2013 17:12:29 +0200 Nikolay Aleksandrov [off-list ref] wrote:
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index 390061d..80e288c 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c@@ -143,10 +143,13 @@ static inline struct bonding *__get_bond_by_port(struct port *port) */ static inline struct port *__get_first_port(struct bonding *bond) { + struct slave *first_slave; + if (bond->slave_cnt == 0) return NULL; + first_slave = bond_first_slave(bond);
As Jay said, it would be be better to have bond_first_slave return NULL (if no slaves), and eliminate slave_cnt. It would also fix a race here between slave_cnt and all slave's being removed.