aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/kernel/trace/ftrace.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2019-09-02 11:20:17 -0700
committerDavid S. Miller <davem@davemloft.net>2019-09-02 11:20:17 -0700
commit765b7590c92d849806e9a27ab3a5a17cfc6a47a9 (patch)
tree4387f5034f870accfd2bb56997c535159da45f06 /kernel/trace/ftrace.c
parentMerge branch 'net-dsa-mv88e6xxx-centralize-SERDES-IRQ-handling' (diff)
parentLinux 5.3-rc7 (diff)
downloadwireguard-linux-765b7590c92d849806e9a27ab3a5a17cfc6a47a9.tar.xz
wireguard-linux-765b7590c92d849806e9a27ab3a5a17cfc6a47a9.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
r8152 conflicts are the NAPI fixes in 'net' overlapping with some tasklet stuff in net-next Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel/trace/ftrace.c')
-rw-r--r--kernel/trace/ftrace.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index eca34503f178..f9821a3374e9 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -3095,6 +3095,14 @@ t_probe_next(struct seq_file *m, loff_t *pos)
hnd = &iter->probe_entry->hlist;
hash = iter->probe->ops.func_hash->filter_hash;
+
+ /*
+ * A probe being registered may temporarily have an empty hash
+ * and it's at the end of the func_probes list.
+ */
+ if (!hash || hash == EMPTY_HASH)
+ return NULL;
+
size = 1 << hash->size_bits;
retry:
@@ -4320,12 +4328,21 @@ register_ftrace_function_probe(char *glob, struct trace_array *tr,
mutex_unlock(&ftrace_lock);
+ /*
+ * Note, there's a small window here that the func_hash->filter_hash
+ * may be NULL or empty. Need to be carefule when reading the loop.
+ */
mutex_lock(&probe->ops.func_hash->regex_lock);
orig_hash = &probe->ops.func_hash->filter_hash;
old_hash = *orig_hash;
hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, old_hash);
+ if (!hash) {
+ ret = -ENOMEM;
+ goto out;
+ }
+
ret = ftrace_match_records(hash, glob, strlen(glob));
/* Nothing found? */