Skip to content

Commit

Permalink
net: devlink: don't ignore errors during dumpit
Browse files Browse the repository at this point in the history
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>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jiri Pirko authored and David S. Miller committed Oct 4, 2019
1 parent 511e6ca commit c62c2cf
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions net/core/devlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,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) {
Expand All @@ -1067,6 +1067,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;
}
Expand Down Expand Up @@ -1242,7 +1245,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) {
Expand All @@ -1265,6 +1268,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;
}
Expand Down Expand Up @@ -1469,7 +1475,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) {
Expand All @@ -1494,6 +1500,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;
}
Expand Down Expand Up @@ -3257,7 +3266,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) {
Expand Down Expand Up @@ -3285,6 +3294,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;
}
Expand Down Expand Up @@ -3513,7 +3525,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) {
Expand Down Expand Up @@ -3546,6 +3558,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;
}
Expand Down Expand Up @@ -4168,7 +4183,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) {
Expand Down Expand Up @@ -4196,6 +4211,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;
}
Expand Down

0 comments on commit c62c2cf

Please sign in to comment.