[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200921190433.1149521-2-jim.cromie@gmail.com>
Date: Mon, 21 Sep 2020 13:04:32 -0600
From: Jim Cromie <jim.cromie@...il.com>
To: jbaron@...mai.com, gregkh@...uxfoundation.org,
linux-kernel@...r.kernel.org
Cc: Jim Cromie <jim.cromie@...il.com>, Petr Mladek <pmladek@...e.com>
Subject: [PATCH 1/2] dyndbg: dont panic over bad input
This BUG_ON, from 2009, caught the impossible case of a word-char both
starting and ending a string (loosely speaking). A bad (reverted)
patch finally hit this case, but even "impossibly bad input" is no
reason to panic the kernel. Instead pr_err and return -EINVAL.
Reported-by: Petr Mladek <pmladek@...e.com>
Signed-off-by: Jim Cromie <jim.cromie@...il.com>
---
lib/dynamic_debug.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 2d4dfd44b0fa5..90ddf07ce34fe 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -259,7 +259,10 @@ static int ddebug_tokenize(char *buf, char *words[], int maxwords)
} else {
for (end = buf; *end && !isspace(*end); end++)
;
- BUG_ON(end == buf);
+ if (end == buf) {
+ pr_err("expected non-empty bareword");
+ return -EINVAL;
+ }
}
/* `buf' is start of word, `end' is one past its end */
--
2.26.2
Powered by blists - more mailing lists