diff options
author | Veaceslav Falico <vfalico@redhat.com> | 2013-03-26 17:43:28 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-04-05 10:04:39 -0700 |
commit | b11b7d9b968aebaf70618db4393612784dfbebcd (patch) | |
tree | 1d4fb543c95b820bcebdff753694f9ea11906787 | |
parent | fbb7347e856f5116114c3ef5945980a3afab121e (diff) | |
download | linux-3.10-b11b7d9b968aebaf70618db4393612784dfbebcd.tar.gz linux-3.10-b11b7d9b968aebaf70618db4393612784dfbebcd.tar.bz2 linux-3.10-b11b7d9b968aebaf70618db4393612784dfbebcd.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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 6734737c953..780c157e05d 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c @@ -183,6 +183,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; } |