From: Jay Vosburgh <fubar@us.ibm.com>
To: netdev@vger.kernel.org
Cc: Jeff Garzik <jgarzik@pobox.com>, Jay Vosburgh <fubar@us.ibm.com>
Subject: [PATCH 4/4] bonding: fix enslavement error unwinds
Date: Fri, 2 May 2008 17:49:40 -0700 [thread overview]
Message-ID: <12097757841898-git-send-email-fubar@us.ibm.com> (raw)
In-Reply-To: <12097757842821-git-send-email-fubar@us.ibm.com>
For commit c2edacf80e155ef54ae4774379d461b60896bc2e, two steps
were rearranged in the enslavement process: netdev_set_master is now
before the call to dev_open to open the slave.
This patch updates the error cases and unwind process at the
end of bond_enslave to match the new order. Without this patch, it is
possible for the enslavement to fail, but leave the slave with IFF_SLAVE
set in its flags.
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
---
drivers/net/bonding/bond_main.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 3977760..b99ccd2 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1425,13 +1425,13 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
res = netdev_set_master(slave_dev, bond_dev);
if (res) {
dprintk("Error %d calling netdev_set_master\n", res);
- goto err_close;
+ goto err_restore_mac;
}
/* open the slave since the application closed it */
res = dev_open(slave_dev);
if (res) {
dprintk("Openning slave %s failed\n", slave_dev->name);
- goto err_restore_mac;
+ goto err_unset_master;
}
new_slave->dev = slave_dev;
@@ -1444,7 +1444,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
*/
res = bond_alb_init_slave(bond, new_slave);
if (res) {
- goto err_unset_master;
+ goto err_close;
}
}
@@ -1619,7 +1619,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
res = bond_create_slave_symlinks(bond_dev, slave_dev);
if (res)
- goto err_unset_master;
+ goto err_close;
printk(KERN_INFO DRV_NAME
": %s: enslaving %s as a%s interface with a%s link.\n",
@@ -1631,12 +1631,12 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
return 0;
/* Undo stages on error */
-err_unset_master:
- netdev_set_master(slave_dev, NULL);
-
err_close:
dev_close(slave_dev);
+err_unset_master:
+ netdev_set_master(slave_dev, NULL);
+
err_restore_mac:
if (!bond->params.fail_over_mac) {
memcpy(addr.sa_data, new_slave->perm_hwaddr, ETH_ALEN);
--
1.5.2.4
next prev parent reply other threads:[~2008-05-03 0:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-03 0:49 [PATCH 0/4] bonding: bug fixes for 2.6.26 Jay Vosburgh
2008-05-03 0:49 ` [PATCH 1/4] bonding: Do not call free_netdev for already registered device Jay Vosburgh
2008-05-03 0:49 ` [PATCH 2/4] bonding: fix error unwind in bonding_store_bonds Jay Vosburgh
2008-05-03 0:49 ` [PATCH 3/4] bonding: Deadlock between bonding_store_bonds and bond_destroy_sysfs Jay Vosburgh
2008-05-03 0:49 ` Jay Vosburgh [this message]
2008-05-03 0:52 ` [PATCH 4/4] bonding: fix enslavement error unwinds David Miller
2008-05-03 1:06 ` [PATCH REPOST " Jay Vosburgh
2008-05-03 1:07 ` David Miller
2008-05-03 0:51 ` [PATCH 3/4] bonding: Deadlock between bonding_store_bonds and bond_destroy_sysfs David Miller
2008-05-03 0:51 ` [PATCH 2/4] bonding: fix error unwind in bonding_store_bonds David Miller
2008-05-03 0:51 ` [PATCH 1/4] bonding: Do not call free_netdev for already registered device David Miller
2008-05-06 16:17 ` Jeff Garzik
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=12097757841898-git-send-email-fubar@us.ibm.com \
--to=fubar@us.ibm.com \
--cc=jgarzik@pobox.com \
--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.