From: Veaceslav Falico Date: Tue, 26 Mar 2013 16:43:28 +0000 (+0100) Subject: bonding: remove already created master sysfs link on failure X-Git-Tag: v3.9-rc5~28^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9fe16b78ee17579cb4f333534cf7043e94c67024;p=profile%2Fcommon%2Fkernel-common.git bonding: remove already created master sysfs link on failure 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 Signed-off-by: David S. Miller --- diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 1c9e09f..db103e0 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; }