]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
tracing: Fix bug when reading system filters on module
authorSteven Rostedt <srostedt@redhat.com>
Tue, 5 Jul 2011 15:36:06 +0000 (11:36 -0400)
committerAndi Kleen <ak@linux.intel.com>
Mon, 1 Aug 2011 20:55:03 +0000 (13:55 -0700)
commiteabdd90b949f20ce315896b5bdd985a571d1bd77
treea684286a5b0802c037a7c126a33f516e57dd6494
parentc7f88b2668a1fe87d6b0497081c03653c44ee80f
tracing: Fix bug when reading system filters on module

[ upstream commit e9dbfae53eeb9fc3d4bb7da3df87fa9875f5da02 ]
 removal

The event system is freed when its nr_events is set to zero. This happens
when a module created an event system and then later the module is
removed. Modules may share systems, so the system is allocated when
it is created and freed when the modules are unloaded and all the
events under the system are removed (nr_events set to zero).

The problem arises when a task opened the "filter" file for the
system. If the module is unloaded and it removed the last event for
that system, the system structure is freed. If the task that opened
the filter file accesses the "filter" file after the system has
been freed, the system will access an invalid pointer.

By adding a ref_count, and using it to keep track of what
is using the event system, we can free it after all users
are finished with the event system.

Cc: <stable@kernel.org>
Reported-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
kernel/trace/trace.h
kernel/trace/trace_events.c
kernel/trace/trace_events_filter.c