Skip to content

Commit 700b2b4

Browse files
committed
fprobe: Fix to ensure the number of active retprobes is not zero
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>
1 parent 2a86ac3 commit 700b2b4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

kernel/trace/fprobe.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ static int fprobe_init_rethook(struct fprobe *fp, int num)
189189
{
190190
int i, size;
191191

192-
if (num < 0)
192+
if (num <= 0)
193193
return -EINVAL;
194194

195195
if (!fp->exit_handler) {
@@ -202,8 +202,8 @@ static int fprobe_init_rethook(struct fprobe *fp, int num)
202202
size = fp->nr_maxactive;
203203
else
204204
size = num * num_possible_cpus() * 2;
205-
if (size < 0)
206-
return -E2BIG;
205+
if (size <= 0)
206+
return -EINVAL;
207207

208208
fp->rethook = rethook_alloc((void *)fp, fprobe_exit_handler);
209209
if (!fp->rethook)

0 commit comments

Comments
 (0)