[<prev] [next>] [day] [month] [year] [list]
Message-Id: <09890143926c494e1cc3939a84eded4c55c27d9e.1618350667.git.aclaudi@redhat.com>
Date: Wed, 14 Apr 2021 00:48:37 +0200
From: Andrea Claudi <aclaudi@...hat.com>
To: netdev@...r.kernel.org
Cc: stephen@...workplumber.org, dsahern@...il.com
Subject: [PATCH iproute2] devlink: always check strslashrsplit() return value
strslashrsplit() return value is not checked in __dl_argv_handle(),
despite the fact that it can return EINVAL.
This commit fix it and make __dl_argv_handle() return error if
strslashrsplit() return an error code.
Fixes: 2f85a9c53587 ("devlink: allow to parse both devlink and port handle in the same time")
Signed-off-by: Andrea Claudi <aclaudi@...hat.com>
---
devlink/devlink.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/devlink/devlink.c b/devlink/devlink.c
index c6e85ff9..faa87b3d 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -965,7 +965,13 @@ static int strtobool(const char *str, bool *p_val)
static int __dl_argv_handle(char *str, char **p_bus_name, char **p_dev_name)
{
- strslashrsplit(str, p_bus_name, p_dev_name);
+ int err;
+
+ err = strslashrsplit(str, p_bus_name, p_dev_name);
+ if (err) {
+ pr_err("Devlink identification (\"bus_name/dev_name\") \"%s\" is invalid\n", str);
+ return err;
+ }
return 0;
}
--
2.30.2
Powered by blists - more mailing lists