netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bridge:Fix incorrect variable assignment on error path in br_sysfs_addbr
@ 2016-03-16 18:31 Nicholas Krause
  0 siblings, 0 replies; 5+ messages in thread
From: Nicholas Krause @ 2016-03-16 18:31 UTC (permalink / raw)
  To: stephen; +Cc: netdev, bridge, davem, linux-kernel

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: Nicholas Krause <xerofoify@gmail.com>
---
 net/bridge/br_sysfs_br.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
index 6b80914..6833d25 100644
--- a/net/bridge/br_sysfs_br.c
+++ b/net/bridge/br_sysfs_br.c
@@ -872,6 +872,7 @@ int br_sysfs_addbr(struct net_device *dev)
 	if (!br->ifobj) {
 		pr_info("%s: can't add kobject (directory) %s/%s\n",
 			__func__, dev->name, SYSFS_BRIDGE_PORT_SUBDIR);
+		err = -EINVAL;
 		goto out3;
 	}
 	return 0;
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [PATCH] bridge:Fix incorrect variable assignment on error path in br_sysfs_addbr
@ 2016-04-03 23:04 Bastien Philbert
  2016-04-04 20:14 ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Bastien Philbert @ 2016-04-03 23:04 UTC (permalink / raw)
  To: stephen; +Cc: davem, netdev, linux-kernel

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>
---
 net/bridge/br_sysfs_br.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
index 6b80914..f4d40ed 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;
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [PATCH] bridge:Fix incorrect variable assignment on error path in br_sysfs_addbr
@ 2016-03-13  2:46 Nicholas Krause
  0 siblings, 0 replies; 5+ messages in thread
From: Nicholas Krause @ 2016-03-13  2:46 UTC (permalink / raw)
  To: stephen; +Cc: netdev, bridge, davem, linux-kernel

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: Nicholas Krause <xerofoify@gmail.com>
---
 net/bridge/br_sysfs_br.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
index 6b80914..6833d25 100644
--- a/net/bridge/br_sysfs_br.c
+++ b/net/bridge/br_sysfs_br.c
@@ -872,6 +872,7 @@ int br_sysfs_addbr(struct net_device *dev)
 	if (!br->ifobj) {
 		pr_info("%s: can't add kobject (directory) %s/%s\n",
 			__func__, dev->name, SYSFS_BRIDGE_PORT_SUBDIR);
+		err = -EINVAL;
 		goto out3;
 	}
 	return 0;
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-04-04 20:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-16 18:31 [PATCH] bridge:Fix incorrect variable assignment on error path in br_sysfs_addbr Nicholas Krause
  -- strict thread matches above, loose matches on Subject: below --
2016-04-03 23:04 Bastien Philbert
2016-04-04 20:14 ` David Miller
2016-04-04 20:16   ` Bastien Philbert
2016-03-13  2:46 Nicholas Krause

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).