diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2009-07-07 01:53:47 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-07-10 05:59:42 -0400 |
commit | 92cf9f8f7e89c6bdbb1a724f879b8b18fc0dfe0f (patch) | |
tree | cb7f7598bc6c9fade407b24fcbf1a83a92a997b7 | |
parent | f088e5471297cc78d7465e1fd997cb1a91a48019 (diff) |
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: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: Frederic 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: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | kernel/trace/trace_ksym.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/kernel/trace/trace_ksym.c b/kernel/trace/trace_ksym.c index 955600929907..72fcb46c39c0 100644 --- a/kernel/trace/trace_ksym.c +++ b/kernel/trace/trace_ksym.c | |||
@@ -158,21 +158,21 @@ static int ksym_trace_get_access_type(char *str) | |||
158 | static int parse_ksym_trace_str(char *input_string, char **ksymname, | 158 | static int parse_ksym_trace_str(char *input_string, char **ksymname, |
159 | unsigned long *addr) | 159 | unsigned long *addr) |
160 | { | 160 | { |
161 | char *delimiter = ":"; | ||
162 | int ret; | 161 | int ret; |
163 | 162 | ||
164 | ret = -EINVAL; | 163 | strstrip(input_string); |
165 | *ksymname = strsep(&input_string, delimiter); | 164 | |
165 | *ksymname = strsep(&input_string, ":"); | ||
166 | *addr = kallsyms_lookup_name(*ksymname); | 166 | *addr = kallsyms_lookup_name(*ksymname); |
167 | 167 | ||
168 | /* Check for malformed request: (2), (1) and (5) */ | 168 | /* Check for malformed request: (2), (1) and (5) */ |
169 | if ((!input_string) || | 169 | if ((!input_string) || |
170 | (strlen(input_string) != (KSYM_TRACER_OP_LEN + 1)) || | 170 | (strlen(input_string) != KSYM_TRACER_OP_LEN) || |
171 | (*addr == 0)) | 171 | (*addr == 0)) |
172 | goto return_code; | 172 | return -EINVAL;; |
173 | |||
173 | ret = ksym_trace_get_access_type(input_string); | 174 | ret = ksym_trace_get_access_type(input_string); |
174 | 175 | ||
175 | return_code: | ||
176 | return ret; | 176 | return ret; |
177 | } | 177 | } |
178 | 178 | ||