aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorTom Zanussi <tzanussi@gmail.com>2009-03-24 03:14:42 -0400
committerIngo Molnar <mingo@elte.hu>2009-03-24 03:26:52 -0400
commit9f58a159d022c8f2533a27708aa267adf4f0e3ce (patch)
tree471fb100abead729ccfbfcc206fb0d5daa03f1c5 /kernel
parent4bda2d517bfa3ce3d7044e06988cdddae7adffe2 (diff)
tracing/filters: disallow integer values for string filters and vice versa
Impact: fix filter use boundary condition / crash Make sure filters for string fields don't use integer values and vice versa. Getting it wrong can crash the system or produce bogus results. Signed-off-by: Tom Zanussi <tzanussi@gmail.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: =?ISO-8859-1?Q?Fr=E9d=E9ric?= Weisbecker <fweisbec@gmail.com> LKML-Reference: <1237878882.8339.61.camel@charm-linux> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace_events_filter.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 9fca8bb1c06b..026be412f356 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -237,9 +237,14 @@ int filter_add_pred(struct ftrace_event_call *call, struct filter_pred *pred)
237 pred->offset = field->offset; 237 pred->offset = field->offset;
238 238
239 if (is_string_field(field->type)) { 239 if (is_string_field(field->type)) {
240 if (!pred->str_val)
241 return -EINVAL;
240 pred->fn = filter_pred_string; 242 pred->fn = filter_pred_string;
241 pred->str_len = field->size; 243 pred->str_len = field->size;
242 return __filter_add_pred(call, pred); 244 return __filter_add_pred(call, pred);
245 } else {
246 if (pred->str_val)
247 return -EINVAL;
243 } 248 }
244 249
245 switch (field->size) { 250 switch (field->size) {