aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/ftrace.h2
-rw-r--r--kernel/trace/ftrace.c12
2 files changed, 5 insertions, 9 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index cd3d2abaf30a..0b4f97d24d7f 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -241,7 +241,7 @@ extern void ftrace_enable_daemon(void);
241# define ftrace_set_filter(buf, len, reset) do { } while (0) 241# define ftrace_set_filter(buf, len, reset) do { } while (0)
242# define ftrace_disable_daemon() do { } while (0) 242# define ftrace_disable_daemon() do { } while (0)
243# define ftrace_enable_daemon() do { } while (0) 243# define ftrace_enable_daemon() do { } while (0)
244static inline void ftrace_release(void *start, unsigned long size) { } 244static inline void ftrace_release_mod(struct module *mod) {}
245static inline int register_ftrace_command(struct ftrace_func_command *cmd) 245static inline int register_ftrace_command(struct ftrace_func_command *cmd)
246{ 246{
247 return -EINVAL; 247 return -EINVAL;
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 46592feab5a6..c701476a648b 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2658,19 +2658,17 @@ static int ftrace_convert_nops(struct module *mod,
2658} 2658}
2659 2659
2660#ifdef CONFIG_MODULES 2660#ifdef CONFIG_MODULES
2661void ftrace_release(void *start, void *end) 2661void ftrace_release_mod(struct module *mod)
2662{ 2662{
2663 struct dyn_ftrace *rec; 2663 struct dyn_ftrace *rec;
2664 struct ftrace_page *pg; 2664 struct ftrace_page *pg;
2665 unsigned long s = (unsigned long)start;
2666 unsigned long e = (unsigned long)end;
2667 2665
2668 if (ftrace_disabled || !start || start == end) 2666 if (ftrace_disabled)
2669 return; 2667 return;
2670 2668
2671 mutex_lock(&ftrace_lock); 2669 mutex_lock(&ftrace_lock);
2672 do_for_each_ftrace_rec(pg, rec) { 2670 do_for_each_ftrace_rec(pg, rec) {
2673 if ((rec->ip >= s) && (rec->ip < e)) { 2671 if (within_module_core(rec->ip, mod)) {
2674 /* 2672 /*
2675 * rec->ip is changed in ftrace_free_rec() 2673 * rec->ip is changed in ftrace_free_rec()
2676 * It should not between s and e if record was freed. 2674 * It should not between s and e if record was freed.
@@ -2702,9 +2700,7 @@ static int ftrace_module_notify(struct notifier_block *self,
2702 mod->num_ftrace_callsites); 2700 mod->num_ftrace_callsites);
2703 break; 2701 break;
2704 case MODULE_STATE_GOING: 2702 case MODULE_STATE_GOING:
2705 ftrace_release(mod->ftrace_callsites, 2703 ftrace_release_mod(mod);
2706 mod->ftrace_callsites +
2707 mod->num_ftrace_callsites);
2708 break; 2704 break;
2709 } 2705 }
2710 2706