summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrii Nakryiko <andrii@kernel.org>2024-12-06 10:34:36 -0800
committerIngo Molnar <mingo@kernel.org>2024-12-09 15:50:32 +0100
commit02c56362a7d3eccc209d5c00d73a06513d2504d5 (patch)
treee0d7eb482d2fd1f68256f7fbf2ef064915f37d71
parentd29e744c71673a71da8f8522799ee02744cad6c9 (diff)
uprobes: Guard against kmemdup() failing in dup_return_instance()
If kmemdup() failed to alloc memory, don't proceed with extra_consumers copy. Fixes: e62f2d492728 ("uprobes: Simplify session consumer tracking") Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/20241206183436.968068-1-andrii@kernel.org
-rw-r--r--kernel/events/uprobes.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 1af950208c2b..1f75a2f91206 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -2048,6 +2048,8 @@ static struct return_instance *dup_return_instance(struct return_instance *old)
struct return_instance *ri;
ri = kmemdup(old, sizeof(*ri), GFP_KERNEL);
+ if (!ri)
+ return NULL;
if (unlikely(old->cons_cnt > 1)) {
ri->extra_consumers = kmemdup(old->extra_consumers,