Skip to content

Commit

Permalink
fprobe: Fix to ensure the number of active retprobes is not zero
Browse files Browse the repository at this point in the history
The number of active retprobes can be zero but it is not acceptable,
so return EINVAL error if detected.

Link: https://lore.kernel.org/all/169750018550.186853.11198884812017796410.stgit@devnote2/

Reported-by: wuqiang.matt <wuqiang.matt@bytedance.com>
Closes: https://lore.kernel.org/all/20231016222103.cb9f426edc60220eabd8aa6a@kernel.org/
Fixes: 5b0ab78 ("fprobe: Add exit_handler support")
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
  • Loading branch information
Masami Hiramatsu (Google) committed Oct 17, 2023
1 parent 2a86ac3 commit 700b2b4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kernel/trace/fprobe.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ static int fprobe_init_rethook(struct fprobe *fp, int num)
{
int i, size;

if (num < 0)
if (num <= 0)
return -EINVAL;

if (!fp->exit_handler) {
Expand All @@ -202,8 +202,8 @@ static int fprobe_init_rethook(struct fprobe *fp, int num)
size = fp->nr_maxactive;
else
size = num * num_possible_cpus() * 2;
if (size < 0)
return -E2BIG;
if (size <= 0)
return -EINVAL;

fp->rethook = rethook_alloc((void *)fp, fprobe_exit_handler);
if (!fp->rethook)
Expand Down

0 comments on commit 700b2b4

Please sign in to comment.