mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
fprobe: Fix to ensure the number of active retprobes is not zero
[ Upstream commit700b2b4397] 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:5b0ab78998("fprobe: Add exit_handler support") Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
f177a579d2
commit
df2cc87f2c
@@ -134,7 +134,7 @@ static int fprobe_init_rethook(struct fprobe *fp, int num)
|
|||||||
{
|
{
|
||||||
int i, size;
|
int i, size;
|
||||||
|
|
||||||
if (num < 0)
|
if (num <= 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (!fp->exit_handler) {
|
if (!fp->exit_handler) {
|
||||||
@@ -147,8 +147,8 @@ static int fprobe_init_rethook(struct fprobe *fp, int num)
|
|||||||
size = fp->nr_maxactive;
|
size = fp->nr_maxactive;
|
||||||
else
|
else
|
||||||
size = num * num_possible_cpus() * 2;
|
size = num * num_possible_cpus() * 2;
|
||||||
if (size < 0)
|
if (size <= 0)
|
||||||
return -E2BIG;
|
return -EINVAL;
|
||||||
|
|
||||||
fp->rethook = rethook_alloc((void *)fp, fprobe_exit_handler);
|
fp->rethook = rethook_alloc((void *)fp, fprobe_exit_handler);
|
||||||
if (!fp->rethook)
|
if (!fp->rethook)
|
||||||
|
|||||||
Reference in New Issue
Block a user