lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 26 Oct 2023 20:29:13 +0900
From:   Masami Hiramatsu (Google) <mhiramat@...nel.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>,
        Mark Rutland <mark.rutland@....com>
Subject: Re: [PATCH] eventfs: Fix WARN_ON() in create_file_dentry()

On Tue, 24 Oct 2023 12:36:28 -0400
Steven Rostedt <rostedt@...dmis.org> wrote:

> From: "Steven Rostedt (Google)" <rostedt@...dmis.org>
> 
> As the comment right above a WARN_ON() in create_file_dentry() states:
> 
>   * Note, with the mutex held, the e_dentry cannot have content
>   * and the ei->is_freed be true at the same time.
> 
> But the WARN_ON() only has:
> 
>   WARN_ON_ONCE(ei->is_free);
> 
> Where to match the comment (and what it should actually do) is:
> 
>   dentry = *e_dentry;
>   WARN_ON_ONCE(dentry && ei->is_free)
> 
> Also in that case, set dentry to NULL (although it should never happen).

Looks good to me.

Reviewed-by: Masami Hiramatsu (Google) <mhiramat@...nel.org>

Thanks!

> 
> Fixes: 5790b1fb3d672 ("eventfs: Remove eventfs_file and just use eventfs_inode")
> Signed-off-by: Steven Rostedt (Google) <rostedt@...dmis.org>
> ---
>  fs/tracefs/event_inode.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c
> index 09ab93357957..4d2da7480e5f 100644
> --- a/fs/tracefs/event_inode.c
> +++ b/fs/tracefs/event_inode.c
> @@ -264,8 +264,9 @@ create_file_dentry(struct eventfs_inode *ei, struct dentry **e_dentry,
>  		 * Note, with the mutex held, the e_dentry cannot have content
>  		 * and the ei->is_freed be true at the same time.
>  		 */
> -		WARN_ON_ONCE(ei->is_freed);
>  		dentry = *e_dentry;
> +		if (WARN_ON_ONCE(dentry && ei->is_freed))
> +			dentry = NULL;
>  		/* The lookup does not need to up the dentry refcount */
>  		if (dentry && !lookup)
>  			dget(dentry);
> -- 
> 2.42.0
> 


-- 
Masami Hiramatsu (Google) <mhiramat@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ