netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch net-next] net: devlink: don't ignore errors during dumpit
@ 2019-10-04  9:50 Jiri Pirko
  2019-10-04 13:21 ` Andrew Lunn
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jiri Pirko @ 2019-10-04  9:50 UTC (permalink / raw)
  To: netdev; +Cc: davem, jakub.kicinski, andrew, mlxsw

From: Jiri Pirko <jiri@mellanox.com>

Currently, some dumpit function may end-up with error which is not
-EMSGSIZE and this error is silently ignored. Use does not have clue
that something wrong happened. Instead of silent ignore, propagate
the error to user.

Suggested-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
 net/core/devlink.c | 30 ++++++++++++++++++++++++------
 1 file changed, 24 insertions(+), 6 deletions(-)

diff --git a/net/core/devlink.c b/net/core/devlink.c
index e48680efe54a..b7edbd14518b 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -1035,7 +1035,7 @@ static int devlink_nl_cmd_sb_pool_get_dumpit(struct sk_buff *msg,
 	struct devlink_sb *devlink_sb;
 	int start = cb->args[0];
 	int idx = 0;
-	int err;
+	int err = 0;
 
 	mutex_lock(&devlink_mutex);
 	list_for_each_entry(devlink, &devlink_list, list) {
@@ -1058,6 +1058,9 @@ static int devlink_nl_cmd_sb_pool_get_dumpit(struct sk_buff *msg,
 out:
 	mutex_unlock(&devlink_mutex);
 
+	if (err != -EMSGSIZE)
+		return err;
+
 	cb->args[0] = idx;
 	return msg->len;
 }
@@ -1233,7 +1236,7 @@ static int devlink_nl_cmd_sb_port_pool_get_dumpit(struct sk_buff *msg,
 	struct devlink_sb *devlink_sb;
 	int start = cb->args[0];
 	int idx = 0;
-	int err;
+	int err = 0;
 
 	mutex_lock(&devlink_mutex);
 	list_for_each_entry(devlink, &devlink_list, list) {
@@ -1256,6 +1259,9 @@ static int devlink_nl_cmd_sb_port_pool_get_dumpit(struct sk_buff *msg,
 out:
 	mutex_unlock(&devlink_mutex);
 
+	if (err != -EMSGSIZE)
+		return err;
+
 	cb->args[0] = idx;
 	return msg->len;
 }
@@ -1460,7 +1466,7 @@ devlink_nl_cmd_sb_tc_pool_bind_get_dumpit(struct sk_buff *msg,
 	struct devlink_sb *devlink_sb;
 	int start = cb->args[0];
 	int idx = 0;
-	int err;
+	int err = 0;
 
 	mutex_lock(&devlink_mutex);
 	list_for_each_entry(devlink, &devlink_list, list) {
@@ -1485,6 +1491,9 @@ devlink_nl_cmd_sb_tc_pool_bind_get_dumpit(struct sk_buff *msg,
 out:
 	mutex_unlock(&devlink_mutex);
 
+	if (err != -EMSGSIZE)
+		return err;
+
 	cb->args[0] = idx;
 	return msg->len;
 }
@@ -3155,7 +3164,7 @@ static int devlink_nl_cmd_param_get_dumpit(struct sk_buff *msg,
 	struct devlink *devlink;
 	int start = cb->args[0];
 	int idx = 0;
-	int err;
+	int err = 0;
 
 	mutex_lock(&devlink_mutex);
 	list_for_each_entry(devlink, &devlink_list, list) {
@@ -3183,6 +3192,9 @@ static int devlink_nl_cmd_param_get_dumpit(struct sk_buff *msg,
 out:
 	mutex_unlock(&devlink_mutex);
 
+	if (err != -EMSGSIZE)
+		return err;
+
 	cb->args[0] = idx;
 	return msg->len;
 }
@@ -3411,7 +3423,7 @@ static int devlink_nl_cmd_port_param_get_dumpit(struct sk_buff *msg,
 	struct devlink *devlink;
 	int start = cb->args[0];
 	int idx = 0;
-	int err;
+	int err = 0;
 
 	mutex_lock(&devlink_mutex);
 	list_for_each_entry(devlink, &devlink_list, list) {
@@ -3444,6 +3456,9 @@ static int devlink_nl_cmd_port_param_get_dumpit(struct sk_buff *msg,
 out:
 	mutex_unlock(&devlink_mutex);
 
+	if (err != -EMSGSIZE)
+		return err;
+
 	cb->args[0] = idx;
 	return msg->len;
 }
@@ -4066,7 +4081,7 @@ static int devlink_nl_cmd_info_get_dumpit(struct sk_buff *msg,
 	struct devlink *devlink;
 	int start = cb->args[0];
 	int idx = 0;
-	int err;
+	int err = 0;
 
 	mutex_lock(&devlink_mutex);
 	list_for_each_entry(devlink, &devlink_list, list) {
@@ -4094,6 +4109,9 @@ static int devlink_nl_cmd_info_get_dumpit(struct sk_buff *msg,
 	}
 	mutex_unlock(&devlink_mutex);
 
+	if (err != -EMSGSIZE)
+		return err;
+
 	cb->args[0] = idx;
 	return msg->len;
 }
-- 
2.21.0


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

* Re: [patch net-next] net: devlink: don't ignore errors during dumpit
  2019-10-04  9:50 [patch net-next] net: devlink: don't ignore errors during dumpit Jiri Pirko
@ 2019-10-04 13:21 ` Andrew Lunn
  2019-10-04 21:28 ` Jakub Kicinski
  2019-10-04 22:15 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2019-10-04 13:21 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: netdev, davem, jakub.kicinski, mlxsw

On Fri, Oct 04, 2019 at 11:50:12AM +0200, Jiri Pirko wrote:
> From: Jiri Pirko <jiri@mellanox.com>
> 
> Currently, some dumpit function may end-up with error which is not
> -EMSGSIZE and this error is silently ignored. Use does not have clue
> that something wrong happened. Instead of silent ignore, propagate
> the error to user.
> 
> Suggested-by: Andrew Lunn <andrew@lunn.ch>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>

Thanks Jiri

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [patch net-next] net: devlink: don't ignore errors during dumpit
  2019-10-04  9:50 [patch net-next] net: devlink: don't ignore errors during dumpit Jiri Pirko
  2019-10-04 13:21 ` Andrew Lunn
@ 2019-10-04 21:28 ` Jakub Kicinski
  2019-10-04 22:15 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2019-10-04 21:28 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: netdev, davem, andrew, mlxsw

On Fri,  4 Oct 2019 11:50:12 +0200, Jiri Pirko wrote:
> From: Jiri Pirko <jiri@mellanox.com>
> 
> Currently, some dumpit function may end-up with error which is not
> -EMSGSIZE and this error is silently ignored. Use does not have clue
> that something wrong happened. Instead of silent ignore, propagate
> the error to user.
> 
> Suggested-by: Andrew Lunn <andrew@lunn.ch>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>

I'd personally err on the side of caution and add this non-EMSGSIZE
handling to all the *_dumpit() helpers, even those which can only get 
a size error today, but I guess it's not super likely the errors will
change for the more static objects..

Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>

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

* Re: [patch net-next] net: devlink: don't ignore errors during dumpit
  2019-10-04  9:50 [patch net-next] net: devlink: don't ignore errors during dumpit Jiri Pirko
  2019-10-04 13:21 ` Andrew Lunn
  2019-10-04 21:28 ` Jakub Kicinski
@ 2019-10-04 22:15 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-10-04 22:15 UTC (permalink / raw)
  To: jiri; +Cc: netdev, jakub.kicinski, andrew, mlxsw

From: Jiri Pirko <jiri@resnulli.us>
Date: Fri,  4 Oct 2019 11:50:12 +0200

> From: Jiri Pirko <jiri@mellanox.com>
> 
> Currently, some dumpit function may end-up with error which is not
> -EMSGSIZE and this error is silently ignored. Use does not have clue
> that something wrong happened. Instead of silent ignore, propagate
> the error to user.
> 
> Suggested-by: Andrew Lunn <andrew@lunn.ch>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>

Applied.

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

end of thread, other threads:[~2019-10-04 22:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-04  9:50 [patch net-next] net: devlink: don't ignore errors during dumpit Jiri Pirko
2019-10-04 13:21 ` Andrew Lunn
2019-10-04 21:28 ` Jakub Kicinski
2019-10-04 22:15 ` David Miller

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).