Skip to content

Commit 02c5636

Browse files
anakryikoIngo Molnar
authored andcommitted
uprobes: Guard against kmemdup() failing in dup_return_instance()
If kmemdup() failed to alloc memory, don't proceed with extra_consumers copy. Fixes: e62f2d4 ("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
1 parent d29e744 commit 02c5636

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/events/uprobes.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2048,6 +2048,8 @@ static struct return_instance *dup_return_instance(struct return_instance *old)
20482048
struct return_instance *ri;
20492049

20502050
ri = kmemdup(old, sizeof(*ri), GFP_KERNEL);
2051+
if (!ri)
2052+
return NULL;
20512053

20522054
if (unlikely(old->cons_cnt > 1)) {
20532055
ri->extra_consumers = kmemdup(old->extra_consumers,

0 commit comments

Comments
 (0)