summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Philbert <bastienphilbert@gmail.com>2016-04-04 02:04:26 +0300
committerDavid S. Miller <davem@davemloft.net>2016-04-04 23:12:37 +0300
commitc862cc9b70526a71d07e7bd86d9b61d1c792cead (patch)
treed24f3d91bc9a6ed01a6190f4e3c34c0247a58fde
parentbe447f305494e019dfc37ea4cdf3b0e4200b4eba (diff)
downloadlinux-c862cc9b70526a71d07e7bd86d9b61d1c792cead.tar.xz
bridge: Fix incorrect variable assignment on error path in br_sysfs_addbr
This fixes the incorrect variable assignment on error path in br_sysfs_addbr for when the call to kobject_create_and_add fails to assign the value of -EINVAL to the returned variable of err rather then incorrectly return zero making callers think this function has succeededed due to the previous assignment being assigned zero when assigning it the successful return value of the call to sysfs_create_group which is zero. Signed-off-by: Bastien Philbert <bastienphilbert@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/bridge/br_sysfs_br.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
index 6b8091407ca3..f4d40edbe8a9 100644
--- a/net/bridge/br_sysfs_br.c
+++ b/net/bridge/br_sysfs_br.c
@@ -870,6 +870,7 @@ int br_sysfs_addbr(struct net_device *dev)
br->ifobj = kobject_create_and_add(SYSFS_BRIDGE_PORT_SUBDIR, brobj);
if (!br->ifobj) {
+ err = -EINVAL;
pr_info("%s: can't add kobject (directory) %s/%s\n",
__func__, dev->name, SYSFS_BRIDGE_PORT_SUBDIR);
goto out3;