From: Steven Rostedt <rostedt@goodmis.org>
To: Jinjie Ruan <ruanjinjie@huawei.com>
Cc: <linux-trace-kernel@vger.kernel.org>
Subject: Re: [PATCH] eventfs: Fix the NULL pointer dereference bug in eventfs_remove_rec()
Date: Fri, 8 Sep 2023 08:25:03 -0400 [thread overview]
Message-ID: <20230908082503.158955ff@gandalf.local.home> (raw)
In-Reply-To: <20230908074816.3724716-1-ruanjinjie@huawei.com>
On Fri, 8 Sep 2023 15:48:16 +0800
Jinjie Ruan <ruanjinjie@huawei.com> wrote:
> diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c
> index 237c6f370ad9..e6efa4078f48 100644
> --- a/fs/tracefs/event_inode.c
> +++ b/fs/tracefs/event_inode.c
> @@ -693,7 +693,7 @@ static void eventfs_remove_rec(struct eventfs_file *ef, struct list_head *head,
> {
> struct eventfs_file *ef_child;
>
> - if (!ef)
> + if (IS_ERR(ef))
> return;
> /*
> * Check recursion depth. It should never be greater than 3:
> @@ -730,7 +730,7 @@ void eventfs_remove(struct eventfs_file *ef)
> struct dentry *dentry_list = NULL;
> struct dentry *dentry;
>
> - if (!ef)
> + if (IS_ERR(ef))
> return;
>
> mutex_lock(&eventfs_mutex);
> --
Now the above will crash if NULL is passed to it. Which can happen!
Usually I would say fix the places where it failed, but I'm fine with doing
both the NULL and ERR checks.
if (IS_ERR_OR_NULL(ef))
return;
-- Steve
next prev parent reply other threads:[~2023-09-08 12:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-08 7:48 [PATCH] eventfs: Fix the NULL pointer dereference bug in eventfs_remove_rec() Jinjie Ruan
2023-09-08 12:25 ` Steven Rostedt [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-09-08 7:49 Jinjie Ruan
2023-09-08 8:26 ` Masami Hiramatsu
2023-09-08 12:26 ` 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=20230908082503.158955ff@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=ruanjinjie@huawei.com \
/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