[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-fe9f57f250ab4d781b99504caeb218ca2db14c1a@git.kernel.org>
Date: Sun, 22 Mar 2009 19:40:37 GMT
From: Ingo Molnar <mingo@...e.hu>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, hpa@...or.com, mingo@...hat.com,
tzanussi@...il.com, fweisbec@...il.com, tglx@...utronix.de,
mingo@...e.hu
Subject: [tip:tracing/filters] tracing: add run-time field descriptions for event filtering, kfree fix
Commit-ID: fe9f57f250ab4d781b99504caeb218ca2db14c1a
Gitweb: http://git.kernel.org/tip/fe9f57f250ab4d781b99504caeb218ca2db14c1a
Author: Ingo Molnar <mingo@...e.hu>
AuthorDate: Sun, 22 Mar 2009 18:41:59 +0100
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Sun, 22 Mar 2009 18:43:25 +0100
tracing: add run-time field descriptions for event filtering, kfree fix
Impact: fix potential kfree of random data in (rare) failure path
Zero-initialize the field structure.
Reported-by: Frederic Weisbecker <fweisbec@...il.com>
Cc: Tom Zanussi <tzanussi@...il.com>
LKML-Reference: <1237710639.7703.46.camel@...rm-linux>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
kernel/trace/trace_events.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 97d4daa..594d78a 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -24,26 +24,31 @@ int trace_define_field(struct ftrace_event_call *call, char *type,
{
struct ftrace_event_field *field;
- field = kmalloc(sizeof(*field), GFP_KERNEL);
+ field = kzalloc(sizeof(*field), GFP_KERNEL);
if (!field)
goto err;
+
field->name = kstrdup(name, GFP_KERNEL);
if (!field->name)
goto err;
+
field->type = kstrdup(type, GFP_KERNEL);
if (!field->type)
goto err;
+
field->offset = offset;
field->size = size;
list_add(&field->link, &call->fields);
return 0;
+
err:
if (field) {
kfree(field->name);
kfree(field->type);
}
kfree(field);
+
return -ENOMEM;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists