summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVeaceslav Falico <vfalico@redhat.com>2013-03-26 17:43:28 +0100
committerBen Hutchings <ben@decadent.org.uk>2013-04-10 03:20:12 +0100
commitca1961f2f8fe965eb75c727c66405c1261339697 (patch)
tree6a6bfb27ed38af98cf75a7d3551b34ccb4ca9482
parent60b93ed2ca1a80adf46940eb32b7fdf3e280674e (diff)
downloadlinux-stable-ca1961f2f8fe965eb75c727c66405c1261339697.tar.gz
linux-stable-ca1961f2f8fe965eb75c727c66405c1261339697.tar.bz2
linux-stable-ca1961f2f8fe965eb75c727c66405c1261339697.zip
bonding: remove already created master sysfs link on failure
[ Upstream commit 9fe16b78ee17579cb4f333534cf7043e94c67024 ] If slave sysfs symlink failes to be created - we end up without removing the master sysfs symlink. Remove it in case of failure. Signed-off-by: Veaceslav Falico <vfalico@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r--drivers/net/bonding/bond_sysfs.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index a549f360f56b..8d923d321f99 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -184,6 +184,11 @@ int bond_create_slave_symlinks(struct net_device *master,
sprintf(linkname, "slave_%s", slave->name);
ret = sysfs_create_link(&(master->dev.kobj), &(slave->dev.kobj),
linkname);
+
+ /* free the master link created earlier in case of error */
+ if (ret)
+ sysfs_remove_link(&(slave->dev.kobj), "master");
+
return ret;
}