From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Andrew Morton <akpm@linux-foundation.org>,
stable@vger.kernel.org, Dan Carpenter <dan.carpenter@linaro.org>,
Ajay Kaher <ajay.kaher@broadcom.com>,
Mathias Krause <minipli@grsecurity.net>
Subject: [for-linus][PATCH 4/9] eventfs: Dont return NULL in eventfs_create_dir()
Date: Thu, 08 Aug 2024 10:20:41 -0400 [thread overview]
Message-ID: <20240808142124.066927349@goodmis.org> (raw)
In-Reply-To: 20240808142037.495820579@goodmis.org
From: Mathias Krause <minipli@grsecurity.net>
Commit 77a06c33a22d ("eventfs: Test for ei->is_freed when accessing
ei->dentry") added another check, testing if the parent was freed after
we released the mutex. If so, the function returns NULL. However, all
callers expect it to either return a valid pointer or an error pointer,
at least since commit 5264a2f4bb3b ("tracing: Fix a NULL vs IS_ERR() bug
in event_subsystem_dir()"). Returning NULL will therefore fail the error
condition check in the caller.
Fix this by substituting the NULL return value with a fitting error
pointer.
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: stable@vger.kernel.org
Fixes: 77a06c33a22d ("eventfs: Test for ei->is_freed when accessing ei->dentry")
Link: https://lore.kernel.org/20240723122522.2724-1-minipli@grsecurity.net
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Ajay Kaher <ajay.kaher@broadcom.com>
Signed-off-by: Mathias Krause <minipli@grsecurity.net>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
fs/tracefs/event_inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c
index 5d88c184f0fc..a9c28a1d5dc8 100644
--- a/fs/tracefs/event_inode.c
+++ b/fs/tracefs/event_inode.c
@@ -736,7 +736,7 @@ struct eventfs_inode *eventfs_create_dir(const char *name, struct eventfs_inode
/* Was the parent freed? */
if (list_empty(&ei->list)) {
cleanup_ei(ei);
- ei = NULL;
+ ei = ERR_PTR(-EBUSY);
}
return ei;
}
--
2.43.0
next prev parent reply other threads:[~2024-08-08 14:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-08 14:20 [for-linus][PATCH 0/9] tracing: Fixes and cleanups for v6.11 Steven Rostedt
2024-08-08 14:20 ` [for-linus][PATCH 1/9] tracing: Have format file honor EVENT_FILE_FL_FREED Steven Rostedt
2024-08-08 14:20 ` [for-linus][PATCH 2/9] tracing: Use refcount for trace_event_file reference counter Steven Rostedt
2024-08-08 14:20 ` [for-linus][PATCH 3/9] tracefs: Fix inode allocation Steven Rostedt
2024-08-08 14:20 ` Steven Rostedt [this message]
2024-08-08 14:20 ` [for-linus][PATCH 5/9] eventfs: Use SRCU for freeing eventfs_inodes Steven Rostedt
2024-08-08 14:20 ` [for-linus][PATCH 6/9] function_graph: Fix the ret_stack used by ftrace_graph_ret_addr() Steven Rostedt
2024-08-08 14:20 ` [for-linus][PATCH 7/9] tracing: Fix overflow in get_free_elt() Steven Rostedt
2024-08-08 14:20 ` [for-linus][PATCH 8/9] ring-buffer: Remove unused function ring_buffer_nr_pages() Steven Rostedt
2024-08-08 14:20 ` [for-linus][PATCH 9/9] tracefs: Use generic inode RCU for synchronizing freeing 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=20240808142124.066927349@goodmis.org \
--to=rostedt@goodmis.org \
--cc=ajay.kaher@broadcom.com \
--cc=akpm@linux-foundation.org \
--cc=dan.carpenter@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=minipli@grsecurity.net \
--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