Merge tag 'usb-3.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
[deliverable/linux.git] / kernel / tracepoint.c
index 01b3bd84daa192ba5fec7d7ed0893d4944090e4e..ac5b23cf7212c6ebb0045bedce2f13ee8d0a19b3 100644 (file)
@@ -181,7 +181,8 @@ static int tracepoint_add_func(struct tracepoint *tp,
        if (tp->regfunc && !static_key_enabled(&tp->key))
                tp->regfunc();
 
-       tp_funcs = tp->funcs;
+       tp_funcs = rcu_dereference_protected(tp->funcs,
+                       lockdep_is_held(&tracepoints_mutex));
        old = func_add(&tp_funcs, func);
        if (IS_ERR(old)) {
                WARN_ON_ONCE(1);
@@ -213,7 +214,8 @@ static int tracepoint_remove_func(struct tracepoint *tp,
 {
        struct tracepoint_func *old, *tp_funcs;
 
-       tp_funcs = tp->funcs;
+       tp_funcs = rcu_dereference_protected(tp->funcs,
+                       lockdep_is_held(&tracepoints_mutex));
        old = func_remove(&tp_funcs, func);
        if (IS_ERR(old)) {
                WARN_ON_ONCE(1);
@@ -282,7 +284,8 @@ EXPORT_SYMBOL_GPL(tracepoint_probe_unregister);
 #ifdef CONFIG_MODULES
 bool trace_module_has_bad_taint(struct module *mod)
 {
-       return mod->taints & ~((1 << TAINT_OOT_MODULE) | (1 << TAINT_CRAP));
+       return mod->taints & ~((1 << TAINT_OOT_MODULE) | (1 << TAINT_CRAP) |
+                              (1 << TAINT_UNSIGNED_MODULE));
 }
 
 static BLOCKING_NOTIFIER_HEAD(tracepoint_notify_list);
@@ -364,7 +367,7 @@ static int tracepoint_module_coming(struct module *mod)
        /*
         * We skip modules that taint the kernel, especially those with different
         * module headers (for forced load), to make sure we don't cause a crash.
-        * Staging and out-of-tree GPL modules are fine.
+        * Staging, out-of-tree, and unsigned GPL modules are fine.
         */
        if (trace_module_has_bad_taint(mod))
                return 0;
@@ -374,8 +377,7 @@ static int tracepoint_module_coming(struct module *mod)
                ret = -ENOMEM;
                goto end;
        }
-       tp_mod->num_tracepoints = mod->num_tracepoints;
-       tp_mod->tracepoints_ptrs = mod->tracepoints_ptrs;
+       tp_mod->mod = mod;
        list_add_tail(&tp_mod->list, &tracepoint_module_list);
        blocking_notifier_call_chain(&tracepoint_notify_list,
                        MODULE_STATE_COMING, tp_mod);
@@ -393,7 +395,7 @@ static void tracepoint_module_going(struct module *mod)
 
        mutex_lock(&tracepoint_module_list_mutex);
        list_for_each_entry(tp_mod, &tracepoint_module_list, list) {
-               if (tp_mod->tracepoints_ptrs == mod->tracepoints_ptrs) {
+               if (tp_mod->mod == mod) {
                        blocking_notifier_call_chain(&tracepoint_notify_list,
                                        MODULE_STATE_GOING, tp_mod);
                        list_del(&tp_mod->list);
@@ -447,9 +449,9 @@ static __init int init_tracepoints(void)
        int ret;
 
        ret = register_module_notifier(&tracepoint_module_nb);
-       if (ret) {
+       if (ret)
                pr_warning("Failed to register tracepoint module enter notifier\n");
-       }
+
        return ret;
 }
 __initcall(init_tracepoints);
This page took 0.025923 seconds and 5 git commands to generate.