Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe9f57f2 authored by Ingo Molnar's avatar Ingo Molnar
Browse files

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: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <1237710639.7703.46.camel@charm-linux>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent cfb180f3
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -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;
}