提交 92cf9f8f 编写于 作者: L Li Zefan 提交者: Ingo Molnar

ksym_tracer: Fix validation of length of access type

Don't take newline into account, otherwise:

 # echo 'pid_max:-w-' > ksym_trace_filter
 # echo -n 'pid_max:rw-' > ksym_trace_filter
 bash: echo: write error: Invalid argument
Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
Acked-by: NFrederic Weisbecker <fweisbec@gmail.com>
Cc: "K.Prasad" <prasad@linux.vnet.ibm.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <4A52E2EB.9070503@cn.fujitsu.com>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 f088e547
...@@ -158,21 +158,21 @@ static int ksym_trace_get_access_type(char *str) ...@@ -158,21 +158,21 @@ static int ksym_trace_get_access_type(char *str)
static int parse_ksym_trace_str(char *input_string, char **ksymname, static int parse_ksym_trace_str(char *input_string, char **ksymname,
unsigned long *addr) unsigned long *addr)
{ {
char *delimiter = ":";
int ret; int ret;
ret = -EINVAL; strstrip(input_string);
*ksymname = strsep(&input_string, delimiter);
*ksymname = strsep(&input_string, ":");
*addr = kallsyms_lookup_name(*ksymname); *addr = kallsyms_lookup_name(*ksymname);
/* Check for malformed request: (2), (1) and (5) */ /* Check for malformed request: (2), (1) and (5) */
if ((!input_string) || if ((!input_string) ||
(strlen(input_string) != (KSYM_TRACER_OP_LEN + 1)) || (strlen(input_string) != KSYM_TRACER_OP_LEN) ||
(*addr == 0)) (*addr == 0))
goto return_code; return -EINVAL;;
ret = ksym_trace_get_access_type(input_string); ret = ksym_trace_get_access_type(input_string);
return_code:
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册