Skip to content

Commit d9815bf

Browse files
sm00throstedt
authored andcommitted
ftrace: Return the first found result in lookup_rec()
It appears that ip ranges can overlap so. In that case lookup_rec() returns whatever results it got last even if it found nothing in last searched page. This breaks an obscure livepatch late module patching usecase: - load livepatch - load the patched module - unload livepatch - try to load livepatch again To fix this return from lookup_rec() as soon as it found the record containing searched-for ip. This used to be this way prior lookup_rec() introduction. Link: http://lkml.kernel.org/r/[email protected] Cc: [email protected] Fixes: 7e16f58 ("ftrace: Separate out functionality from ftrace_location_range()") Signed-off-by: Artem Savkov <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent 2910b5a commit d9815bf

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/trace/ftrace.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,6 +1547,8 @@ static struct dyn_ftrace *lookup_rec(unsigned long start, unsigned long end)
15471547
rec = bsearch(&key, pg->records, pg->index,
15481548
sizeof(struct dyn_ftrace),
15491549
ftrace_cmp_recs);
1550+
if (rec)
1551+
break;
15501552
}
15511553
return rec;
15521554
}

0 commit comments

Comments
 (0)