43 lines
1.4 KiB
Diff
43 lines
1.4 KiB
Diff
From 6b8fa2ea2d5024345277240acc2252c049e561b3 Mon Sep 17 00:00:00 2001
|
|
From: Andrea Claudi <aclaudi@redhat.com>
|
|
Date: Wed, 14 Apr 2021 00:48:37 +0200
|
|
Subject: [PATCH] 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@redhat.com>
|
|
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
|
|
Conflict: NA
|
|
Reference: https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit?id=6b8fa2ea2d5024345277240acc2252c049e561b3
|
|
---
|
|
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.23.0
|
|
|