Linux Trace Kernel
 help / color / mirror / Atom feed
* [PATCH] uprobes: Free utask on dup_return_instance() failure
@ 2026-08-22  5:46 Keke Ming
  2026-08-22  6:00 ` sashiko-bot
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Keke Ming @ 2026-08-22  5:46 UTC (permalink / raw)
  To: Masami Hiramatsu, Oleg Nesterov, Peter Zijlstra
  Cc: linux-kernel, linux-trace-kernel, linux-perf-users, Keke Ming

dup_utask() installs the new uprobe_task in t->utask before copying
return_instances. If dup_return_instance() fails, the partially copied
utask is left attached to the child task.

Free the partially copied utask before returning -ENOMEM.

Signed-off-by: Keke Ming <ming.jvle@gmail.com>
---
 kernel/events/uprobes.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index b25531331902..0c8a664a0fe5 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -2140,8 +2140,10 @@ static int dup_utask(struct task_struct *t, struct uprobe_task *o_utask)
 	p = &n_utask->return_instances;
 	for (o = o_utask->return_instances; o; o = o->next) {
 		n = dup_return_instance(o);
-		if (!n)
+		if (!n) {
+			uprobe_free_utask(t);
 			return -ENOMEM;
+		}
 
 		/* if uprobe is non-NULL, we'll have an extra refcount for uprobe */
 		uprobe = hprobe_expire(&o->hprobe, true);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-08-24 19:54 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-22  5:46 [PATCH] uprobes: Free utask on dup_return_instance() failure Keke Ming
2026-08-22  6:00 ` sashiko-bot
2026-08-23 12:02   ` Masami Hiramatsu
2026-08-23 13:00     ` Keke Ming
2026-08-22 15:09 ` [PATCH v2] " Keke Ming
2026-08-22 15:16   ` sashiko-bot
2026-08-23 15:38 ` [PATCH] " Oleg Nesterov
2026-08-23 16:26   ` Keke Ming
2026-08-23 19:41     ` Oleg Nesterov
2026-08-24 11:22       ` Keke Ming
2026-08-24 15:57         ` Oleg Nesterov
2026-08-24 19:54           ` Andrii Nakryiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox