* [PATCH 1/2] tracing/filters: add missing unlock in a failure path
@ 2009-05-15 3:07 Li Zefan
2009-05-15 3:07 ` [PATCH 2/2] tracing/filters: fix off-by-one bug Li Zefan
2009-05-15 14:42 ` [tip:tracing/core] tracing/filters: add missing unlock in a failure path tip-bot for Li Zefan
0 siblings, 2 replies; 4+ messages in thread
From: Li Zefan @ 2009-05-15 3:07 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Steven Rostedt, Frederic Weisbecker, Tom Zanussi, LKML
[ Impact: fix deadlock in a rare case we fail to allocate memory ]
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
kernel/trace/trace_events_filter.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 85ad6a8..22c2998 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -1079,9 +1079,10 @@ int apply_event_filter(struct ftrace_event_call *call, char *filter_string)
return 0;
}
+ err = -ENOMEM;
ps = kzalloc(sizeof(*ps), GFP_KERNEL);
if (!ps)
- return -ENOMEM;
+ goto out_unlock;
filter_disable_preds(call);
replace_filter_string(call->filter, filter_string);
@@ -1101,7 +1102,7 @@ out:
filter_opstack_clear(ps);
postfix_clear(ps);
kfree(ps);
-
+out_unlock:
mutex_unlock(&filter_mutex);
return err;
@@ -1123,9 +1124,10 @@ int apply_subsystem_event_filter(struct event_subsystem *system,
return 0;
}
+ err = -ENOMEM;
ps = kzalloc(sizeof(*ps), GFP_KERNEL);
if (!ps)
- return -ENOMEM;
+ goto out_unlock;
filter_free_subsystem_preds(system);
replace_filter_string(system->filter, filter_string);
@@ -1145,7 +1147,7 @@ out:
filter_opstack_clear(ps);
postfix_clear(ps);
kfree(ps);
-
+out_unlock:
mutex_unlock(&filter_mutex);
return err;
--
1.5.4.rc3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] tracing/filters: fix off-by-one bug
2009-05-15 3:07 [PATCH 1/2] tracing/filters: add missing unlock in a failure path Li Zefan
@ 2009-05-15 3:07 ` Li Zefan
2009-05-15 14:43 ` [tip:tracing/core] " tip-bot for Li Zefan
2009-05-15 14:42 ` [tip:tracing/core] tracing/filters: add missing unlock in a failure path tip-bot for Li Zefan
1 sibling, 1 reply; 4+ messages in thread
From: Li Zefan @ 2009-05-15 3:07 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Steven Rostedt, Frederic Weisbecker, Tom Zanussi, LKML
We should leave the last slot for the ending '\0'.
[ Impact: fix possible crash when the length of an operand is 128 ]
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
kernel/trace/trace_events_filter.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 22c2998..a7430b1 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -736,7 +736,7 @@ static inline void clear_operand_string(struct filter_parse_state *ps)
static inline int append_operand_char(struct filter_parse_state *ps, char c)
{
- if (ps->operand.tail == MAX_FILTER_STR_VAL)
+ if (ps->operand.tail == MAX_FILTER_STR_VAL - 1)
return -EINVAL;
ps->operand.string[ps->operand.tail++] = c;
--
1.5.4.rc3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [tip:tracing/core] tracing/filters: add missing unlock in a failure path
2009-05-15 3:07 [PATCH 1/2] tracing/filters: add missing unlock in a failure path Li Zefan
2009-05-15 3:07 ` [PATCH 2/2] tracing/filters: fix off-by-one bug Li Zefan
@ 2009-05-15 14:42 ` tip-bot for Li Zefan
1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Li Zefan @ 2009-05-15 14:42 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, rostedt, lizf, tglx
Commit-ID: 8cd995b6deedf98b7694ed32a786ee7f793d1eec
Gitweb: http://git.kernel.org/tip/8cd995b6deedf98b7694ed32a786ee7f793d1eec
Author: Li Zefan <lizf@cn.fujitsu.com>
AuthorDate: Fri, 15 May 2009 11:07:27 +0800
Committer: Steven Rostedt <rostedt@goodmis.org>
CommitDate: Thu, 14 May 2009 23:55:10 -0400
tracing/filters: add missing unlock in a failure path
[ Impact: fix deadlock in a rare case we fail to allocate memory ]
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <4A0CDC6F.7070200@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace_events_filter.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 85ad6a8..22c2998 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -1079,9 +1079,10 @@ int apply_event_filter(struct ftrace_event_call *call, char *filter_string)
return 0;
}
+ err = -ENOMEM;
ps = kzalloc(sizeof(*ps), GFP_KERNEL);
if (!ps)
- return -ENOMEM;
+ goto out_unlock;
filter_disable_preds(call);
replace_filter_string(call->filter, filter_string);
@@ -1101,7 +1102,7 @@ out:
filter_opstack_clear(ps);
postfix_clear(ps);
kfree(ps);
-
+out_unlock:
mutex_unlock(&filter_mutex);
return err;
@@ -1123,9 +1124,10 @@ int apply_subsystem_event_filter(struct event_subsystem *system,
return 0;
}
+ err = -ENOMEM;
ps = kzalloc(sizeof(*ps), GFP_KERNEL);
if (!ps)
- return -ENOMEM;
+ goto out_unlock;
filter_free_subsystem_preds(system);
replace_filter_string(system->filter, filter_string);
@@ -1145,7 +1147,7 @@ out:
filter_opstack_clear(ps);
postfix_clear(ps);
kfree(ps);
-
+out_unlock:
mutex_unlock(&filter_mutex);
return err;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [tip:tracing/core] tracing/filters: fix off-by-one bug
2009-05-15 3:07 ` [PATCH 2/2] tracing/filters: fix off-by-one bug Li Zefan
@ 2009-05-15 14:43 ` tip-bot for Li Zefan
0 siblings, 0 replies; 4+ messages in thread
From: tip-bot for Li Zefan @ 2009-05-15 14:43 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, rostedt, lizf, tglx
Commit-ID: 5872144f64b34a5942f6b4acedc90b02de72c58b
Gitweb: http://git.kernel.org/tip/5872144f64b34a5942f6b4acedc90b02de72c58b
Author: Li Zefan <lizf@cn.fujitsu.com>
AuthorDate: Fri, 15 May 2009 11:07:56 +0800
Committer: Steven Rostedt <rostedt@goodmis.org>
CommitDate: Thu, 14 May 2009 23:55:12 -0400
tracing/filters: fix off-by-one bug
We should leave the last slot for the ending '\0'.
[ Impact: fix possible crash when the length of an operand is 128 ]
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <4A0CDC8C.30602@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace_events_filter.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 22c2998..a7430b1 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -736,7 +736,7 @@ static inline void clear_operand_string(struct filter_parse_state *ps)
static inline int append_operand_char(struct filter_parse_state *ps, char c)
{
- if (ps->operand.tail == MAX_FILTER_STR_VAL)
+ if (ps->operand.tail == MAX_FILTER_STR_VAL - 1)
return -EINVAL;
ps->operand.string[ps->operand.tail++] = c;
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-05-15 14:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-15 3:07 [PATCH 1/2] tracing/filters: add missing unlock in a failure path Li Zefan
2009-05-15 3:07 ` [PATCH 2/2] tracing/filters: fix off-by-one bug Li Zefan
2009-05-15 14:43 ` [tip:tracing/core] " tip-bot for Li Zefan
2009-05-15 14:42 ` [tip:tracing/core] tracing/filters: add missing unlock in a failure path tip-bot for Li Zefan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox