mirror of
https://github.com/adulau/aha.git
synced 2025-01-01 05:36:24 +00:00
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>
This commit is contained in:
parent
4bda2d517b
commit
9f58a159d0
1 changed files with 5 additions and 0 deletions
|
@ -237,9 +237,14 @@ int filter_add_pred(struct ftrace_event_call *call, struct filter_pred *pred)
|
||||||
pred->offset = field->offset;
|
pred->offset = field->offset;
|
||||||
|
|
||||||
if (is_string_field(field->type)) {
|
if (is_string_field(field->type)) {
|
||||||
|
if (!pred->str_val)
|
||||||
|
return -EINVAL;
|
||||||
pred->fn = filter_pred_string;
|
pred->fn = filter_pred_string;
|
||||||
pred->str_len = field->size;
|
pred->str_len = field->size;
|
||||||
return __filter_add_pred(call, pred);
|
return __filter_add_pred(call, pred);
|
||||||
|
} else {
|
||||||
|
if (pred->str_val)
|
||||||
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (field->size) {
|
switch (field->size) {
|
||||||
|
|
Loading…
Reference in a new issue