@@ -46,7 +46,6 @@ struct trace_fprobe {
4646 struct fprobe fp ;
4747 const char * symbol ;
4848 struct tracepoint * tpoint ;
49- struct module * mod ;
5049 struct trace_probe tp ;
5150};
5251
@@ -426,7 +425,6 @@ static struct trace_fprobe *alloc_trace_fprobe(const char *group,
426425 const char * event ,
427426 const char * symbol ,
428427 struct tracepoint * tpoint ,
429- struct module * mod ,
430428 int nargs , bool is_return )
431429{
432430 struct trace_fprobe * tf __free (free_trace_fprobe ) = NULL ;
@@ -446,7 +444,6 @@ static struct trace_fprobe *alloc_trace_fprobe(const char *group,
446444 tf -> fp .entry_handler = fentry_dispatcher ;
447445
448446 tf -> tpoint = tpoint ;
449- tf -> mod = mod ;
450447
451448 ret = trace_probe_init (& tf -> tp , event , group , false, nargs );
452449 if (ret < 0 )
@@ -776,7 +773,6 @@ static void __unregister_trace_fprobe(struct trace_fprobe *tf)
776773 tracepoint_probe_unregister (tf -> tpoint ,
777774 tf -> tpoint -> probestub , NULL );
778775 tf -> tpoint = NULL ;
779- tf -> mod = NULL ;
780776 }
781777 }
782778}
@@ -1001,23 +997,23 @@ static int __tracepoint_probe_module_cb(struct notifier_block *self,
1001997
1002998 mutex_lock (& event_mutex );
1003999 for_each_trace_fprobe (tf , pos ) {
1000+ if (!trace_fprobe_is_tracepoint (tf ))
1001+ continue ;
10041002 if (val == MODULE_STATE_COMING && tf -> tpoint == TRACEPOINT_STUB ) {
10051003 tpoint = find_tracepoint_in_module (tp_mod -> mod , tf -> symbol );
10061004 if (tpoint ) {
10071005 tf -> tpoint = tpoint ;
1008- tf -> mod = tp_mod -> mod ;
10091006 if (!WARN_ON_ONCE (__regsiter_tracepoint_fprobe (tf )) &&
10101007 trace_probe_is_enabled (& tf -> tp ))
10111008 reenable_trace_fprobe (tf );
10121009 }
1013- } else if (val == MODULE_STATE_GOING && tp_mod -> mod == tf -> mod ) {
1010+ } else if (val == MODULE_STATE_GOING &&
1011+ tf -> tpoint != TRACEPOINT_STUB &&
1012+ within_module ((unsigned long )tf -> tpoint -> probestub , tp_mod -> mod )) {
10141013 unregister_fprobe (& tf -> fp );
1015- if (trace_fprobe_is_tracepoint (tf )) {
1016- tracepoint_probe_unregister (tf -> tpoint ,
1017- tf -> tpoint -> probestub , NULL );
1018- tf -> tpoint = TRACEPOINT_STUB ;
1019- tf -> mod = NULL ;
1020- }
1014+ tracepoint_probe_unregister (tf -> tpoint ,
1015+ tf -> tpoint -> probestub , NULL );
1016+ tf -> tpoint = TRACEPOINT_STUB ;
10211017 }
10221018 }
10231019 mutex_unlock (& event_mutex );
@@ -1218,8 +1214,7 @@ static int trace_fprobe_create_internal(int argc, const char *argv[],
12181214 return ret ;
12191215
12201216 /* setup a probe */
1221- tf = alloc_trace_fprobe (group , event , symbol , tpoint , tp_mod ,
1222- argc , is_return );
1217+ tf = alloc_trace_fprobe (group , event , symbol , tpoint , argc , is_return );
12231218 if (IS_ERR (tf )) {
12241219 ret = PTR_ERR (tf );
12251220 /* This must return -ENOMEM, else there is a bug */
0 commit comments