From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
stable@vger.kernel.org, Rafael Mendonca <rafaelmendsr@gmail.com>
Subject: [for-linus][PATCH 4/6] fprobe: Check rethook_alloc() return in rethook initialization
Date: Sat, 05 Nov 2022 16:50:53 -0400 [thread overview]
Message-ID: <20221105205137.904415773@goodmis.org> (raw)
In-Reply-To: 20221105205049.462806482@goodmis.org
From: Rafael Mendonca <rafaelmendsr@gmail.com>
Check if fp->rethook succeeded to be allocated. Otherwise, if
rethook_alloc() fails, then we end up dereferencing a NULL pointer in
rethook_add_node().
Link: https://lore.kernel.org/all/20221025031209.954836-1-rafaelmendsr@gmail.com/
Fixes: 5b0ab78998e3 ("fprobe: Add exit_handler support")
Cc: stable@vger.kernel.org
Signed-off-by: Rafael Mendonca <rafaelmendsr@gmail.com>
Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
kernel/trace/fprobe.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/trace/fprobe.c b/kernel/trace/fprobe.c
index aac63ca9c3d1..71614b2a67ff 100644
--- a/kernel/trace/fprobe.c
+++ b/kernel/trace/fprobe.c
@@ -141,6 +141,8 @@ static int fprobe_init_rethook(struct fprobe *fp, int num)
return -E2BIG;
fp->rethook = rethook_alloc((void *)fp, fprobe_exit_handler);
+ if (!fp->rethook)
+ return -ENOMEM;
for (i = 0; i < size; i++) {
struct fprobe_rethook_node *node;
--
2.35.1
next prev parent reply other threads:[~2022-11-05 20:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-05 20:50 [for-linus][PATCH 0/6] tracing: Fixes for 6.1 Steven Rostedt
2022-11-05 20:50 ` [for-linus][PATCH 1/6] ring-buffer: Check for NULL cpu_buffer in ring_buffer_wake_waiters() Steven Rostedt
2022-11-05 20:50 ` [for-linus][PATCH 2/6] ftrace: Fix use-after-free for dynamic ftrace_ops Steven Rostedt
2022-11-05 20:50 ` [for-linus][PATCH 3/6] kprobe: reverse kp->flags when arm_kprobe failed Steven Rostedt
2022-11-05 20:50 ` Steven Rostedt [this message]
2022-11-05 20:50 ` [for-linus][PATCH 5/6] tracing/fprobe: Fix to check whether fprobe is registered correctly Steven Rostedt
2022-11-05 20:50 ` [for-linus][PATCH 6/6] tracing: kprobe: Fix memory leak in test_gen_kprobe/kretprobe_cmd() Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221105205137.904415773@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=rafaelmendsr@gmail.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox