Skip to content

Commit f322e26

Browse files
committed
Merge tag 'trace-fixes-v3.15-rc4-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull tracing fixes from Steven Rostedt: "This contains two fixes. The first is a long standing bug that causes bogus data to show up in the refcnt field of the module_refcnt tracepoint. It was introduced by a merge conflict resolution back in 2.6.35-rc days. The result should be 'refcnt = incs - decs', but instead it did 'refcnt = incs + decs'. The second fix is to a bug that was introduced in this merge window that allowed for a tracepoint funcs pointer to be used after it was freed. Moving the location of where the probes are released solved the problem" * tag 'trace-fixes-v3.15-rc4-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: tracepoint: Fix use of tracepoint funcs after rcu free trace: module: Maintain a valid user count
2 parents d86561b + 8058bd0 commit f322e26

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

include/trace/events/module.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ DECLARE_EVENT_CLASS(module_refcnt,
8080

8181
TP_fast_assign(
8282
__entry->ip = ip;
83-
__entry->refcnt = __this_cpu_read(mod->refptr->incs) + __this_cpu_read(mod->refptr->decs);
83+
__entry->refcnt = __this_cpu_read(mod->refptr->incs) - __this_cpu_read(mod->refptr->decs);
8484
__assign_str(name, mod->name);
8585
),
8686

kernel/tracepoint.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ static int tracepoint_add_func(struct tracepoint *tp,
188188
WARN_ON_ONCE(1);
189189
return PTR_ERR(old);
190190
}
191-
release_probes(old);
192191

193192
/*
194193
* rcu_assign_pointer has a smp_wmb() which makes sure that the new
@@ -200,6 +199,7 @@ static int tracepoint_add_func(struct tracepoint *tp,
200199
rcu_assign_pointer(tp->funcs, tp_funcs);
201200
if (!static_key_enabled(&tp->key))
202201
static_key_slow_inc(&tp->key);
202+
release_probes(old);
203203
return 0;
204204
}
205205

@@ -221,7 +221,6 @@ static int tracepoint_remove_func(struct tracepoint *tp,
221221
WARN_ON_ONCE(1);
222222
return PTR_ERR(old);
223223
}
224-
release_probes(old);
225224

226225
if (!tp_funcs) {
227226
/* Removed last function */
@@ -232,6 +231,7 @@ static int tracepoint_remove_func(struct tracepoint *tp,
232231
static_key_slow_dec(&tp->key);
233232
}
234233
rcu_assign_pointer(tp->funcs, tp_funcs);
234+
release_probes(old);
235235
return 0;
236236
}
237237

0 commit comments

Comments
 (0)