linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: hao.ge@linux.dev
To: rostedt@goodmis.org, mhiramat@kernel.org, mathieu.desnoyers@efficios.com
Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	Hao Ge <gehao@kylinos.cn>
Subject: [PATCH] eventfs: Directly return NULL to avoid null point dereferenced
Date: Sat, 11 May 2024 10:42:55 +0800	[thread overview]
Message-ID: <20240511024255.34767-1-hao.ge@linux.dev> (raw)

From: Hao Ge <gehao@kylinos.cn>

When the condition ei->is_free holds,we return NULL directly to
avoid update_events_attr to use NULL point about ei.

Fixes: 8186fff7ab64 ("tracefs/eventfs: Use root and instance inodes as default ownership")
Signed-off-by: Hao Ge <gehao@kylinos.cn>
---
 fs/tracefs/event_inode.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c
index a878cea70f4c..da2827c6acc2 100644
--- a/fs/tracefs/event_inode.c
+++ b/fs/tracefs/event_inode.c
@@ -346,8 +346,7 @@ static struct eventfs_inode *eventfs_find_events(struct dentry *dentry)
 		 * doesn't matter.
 		 */
 		if (ei->is_freed) {
-			ei = NULL;
-			break;
+			return NULL;
 		}
 		// Walk upwards until you find the events inode
 	} while (!ei->is_events);
-- 
2.25.1


             reply	other threads:[~2024-05-11  2:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-11  2:42 hao.ge [this message]
2024-05-12 17:12 ` [PATCH] eventfs: Directly return NULL to avoid null point dereferenced Markus Elfring
2024-05-13  3:25   ` Hao Ge
2024-05-13  5:33     ` [PATCH v2] eventfs: Fix a possible null pointer dereference in eventfs_find_events hao.ge

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=20240511024255.34767-1-hao.ge@linux.dev \
    --to=hao.ge@linux.dev \
    --cc=gehao@kylinos.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).