[patch net-next v3 01/28] net: Check CHANGEUPPER notifier return value

From
Jiri Pirko <jiri@resnulli.us>
Date
2015-12-03 11:12:39
Reply to
Jiri Pirko, 2015-12-03
From: Ido Schimmel <redacted>

switchdev drivers reflect the newly requested topology to hardware when
CHANGEUPPER is received, after software links were already formed.
However, the operation can fail and user will not be notified, as the
return value of the notifier is not checked.

Add this check and rollback software links if necessary.

Signed-off-by: Ido Schimmel <redacted>
Signed-off-by: Jiri Pirko <redacted>
---
v2->v3:
- convert notify return value to errno and check it instead of
  the notify return value - spotted by JohnF
v1->v2:
-new patch
---
 net/core/dev.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 5df6cbc..939cd1b 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5490,8 +5490,12 @@ static int __netdev_upper_dev_link(struct net_device *dev,
 			goto rollback_lower_mesh;
 	}
 
-	call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev,
-				      &changeupper_info.info);
+	ret = call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev,
+					    &changeupper_info.info);
+	ret = notifier_to_errno(ret);
+	if (ret)
+		goto rollback_lower_mesh;
+
 	return 0;
 
 rollback_lower_mesh:
-- 
1.9.3
Thread (33 messages) 33 messages, 3 authors, last reply 2015-12-03
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help