From: Ingo Molnar <mingo@elte.hu>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
tzanussi@gmail.com, fweisbec@gmail.com, tglx@linutronix.de,
mingo@elte.hu
Subject: [tip:tracing/filters] tracing: add run-time field descriptions for event filtering, kfree fix
Date: Sun, 22 Mar 2009 19:40:37 GMT [thread overview]
Message-ID: <tip-fe9f57f250ab4d781b99504caeb218ca2db14c1a@git.kernel.org> (raw)
In-Reply-To: <1237710639.7703.46.camel@charm-linux>
Commit-ID: fe9f57f250ab4d781b99504caeb218ca2db14c1a
Gitweb: http://git.kernel.org/tip/fe9f57f250ab4d781b99504caeb218ca2db14c1a
Author: Ingo Molnar <mingo@elte.hu>
AuthorDate: Sun, 22 Mar 2009 18:41:59 +0100
Committer: Ingo Molnar <mingo@elte.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@gmail.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <1237710639.7703.46.camel@charm-linux>
Signed-off-by: Ingo Molnar <mingo@elte.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;
}
next prev parent reply other threads:[~2009-03-22 19:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-22 8:30 [PATCH 1/4] tracing: add run-time field descriptions for event filtering Tom Zanussi
2009-03-22 17:39 ` Frederic Weisbecker
2009-03-22 17:44 ` Ingo Molnar
2009-03-22 18:00 ` Frederic Weisbecker
2009-03-23 18:51 ` Steven Rostedt
2009-03-22 19:39 ` [tip:tracing/filters] " Tom Zanussi
2009-03-22 19:40 ` Ingo Molnar [this message]
2009-03-23 18:12 ` [PATCH 1/4] " Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-fe9f57f250ab4d781b99504caeb218ca2db14c1a@git.kernel.org \
--to=mingo@elte.hu \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=tzanussi@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox