mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-29 09:12:07 +00:00
uprobes: Guard against kmemdup() failing in dup_return_instance()
If kmemdup() failed to alloc memory, don't proceed with extra_consumers
copy.
Fixes: e62f2d4927
("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
This commit is contained in:
parent
d29e744c71
commit
02c56362a7
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user