[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wgJouS5fWAf7ReooLLES0rq2F=V1s-fPyLDX+OoXX+JBw@mail.gmail.com>
Date: Wed, 3 Jan 2024 14:06:45 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Linux Trace Kernel <linux-trace-kernel@...r.kernel.org>, Masami Hiramatsu <mhiramat@...nel.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>, Al Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>, linux-fsdevel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH] eventfs: Stop using dcache_readdir() for getdents()
On Wed, 3 Jan 2024 at 13:54, Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> Here's an updated patch that builds, and is PURELY AN EXAMPLE.
Oh, and while doing this patch, I found another bug in tracefs,
although it happily is one that doesn't have any way to trigger.
Tracefs has code like this:
if (dentry->d_inode->i_mode & S_IFDIR) {
and that's very wrong. S_IFDIR is not a bitmask, it's a value that is
part of S_IFMT.
The reason this bug doesn't have any way to trigger is that I think
tracefs can only have S_IFMT values of S_IFDIR and S_IFREG, and those
happen to not have any bits in common, so doing it as a bit test is
wrong, but happens to work.
The test *should* be done as
if (S_ISDIR(dentry->d_inode->i_mode)) {
(note "IS" vs "IF" - not the greatest user experience ever, but hey,
it harkens back to Ye Olden Times).
Linus
Powered by blists - more mailing lists