]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
tracing/eprobe: Fix to release eprobe when failed to add dyn_event
authorMasami Hiramatsu (Google) <mhiramat@kernel.org>
Fri, 29 Nov 2024 16:47:47 +0000 (01:47 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2024 18:51:44 +0000 (19:51 +0100)
[ Upstream commit 494b332064c0ce2f7392fa92632bc50191c1b517 ]

Fix eprobe event to unregister event call and release eprobe when it fails
to add dynamic event correctly.

Link: https://lore.kernel.org/all/173289886698.73724.1959899350183686006.stgit@devnote2/
Fixes: 7491e2c44278 ("tracing: Add a probe that attaches to trace events")
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/trace/trace_eprobe.c

index 085f056e66f193b46e8e3ac7c9214fbff6030e58..6ba95e32df3882f59a08832aa63225382051f533 100644 (file)
@@ -979,6 +979,11 @@ static int __trace_eprobe_create(int argc, const char *argv[])
                goto error;
        }
        ret = dyn_event_add(&ep->devent, &ep->tp.event->call);
+       if (ret < 0) {
+               trace_probe_unregister_event_call(&ep->tp);
+               mutex_unlock(&event_mutex);
+               goto error;
+       }
        mutex_unlock(&event_mutex);
        return ret;
 parse_error: