Skip to content

Commit c539fef

Browse files
committed
tracing: fprobe: Fix to remove recorded module addresses from filter
Even if there is a memory allocation failure in fprobe_addr_list_add(), there is a partial list of module addresses. So remove the recorded addresses from filter if exists. This also removes the redundant ret local variable. Fixes: a3dc298 ("tracing: fprobe: Cleanup fprobe hash when module unloading") Signed-off-by: Masami Hiramatsu (Google) <[email protected]> Cc: [email protected] Reviewed-by: Menglong Dong <[email protected]>
1 parent dc3382f commit c539fef

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

kernel/trace/fprobe.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,9 @@ static int fprobe_addr_list_add(struct fprobe_addr_list *alist, unsigned long ad
428428
{
429429
unsigned long *addrs;
430430

431-
if (alist->index >= alist->size)
432-
return -ENOMEM;
431+
/* Previously we failed to expand the list. */
432+
if (alist->index == alist->size)
433+
return -ENOSPC;
433434

434435
alist->addrs[alist->index++] = addr;
435436
if (alist->index < alist->size)
@@ -489,7 +490,7 @@ static int fprobe_module_callback(struct notifier_block *nb,
489490
for (i = 0; i < FPROBE_IP_TABLE_SIZE; i++)
490491
fprobe_remove_node_in_module(mod, &fprobe_ip_table[i], &alist);
491492

492-
if (alist.index < alist.size && alist.index > 0)
493+
if (alist.index > 0)
493494
ftrace_set_filter_ips(&fprobe_graph_ops.ops,
494495
alist.addrs, alist.index, 1, 0);
495496
mutex_unlock(&fprobe_mutex);

0 commit comments

Comments
 (0)