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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200420113850.GC3906674@kroah.com>
Date:   Mon, 20 Apr 2020 13:38:50 +0200
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Luis Chamberlain <mcgrof@...nel.org>
Cc:     axboe@...nel.dk, viro@...iv.linux.org.uk, bvanassche@....org,
        rostedt@...dmis.org, mingo@...hat.com, jack@...e.cz,
        ming.lei@...hat.com, nstange@...e.de, akpm@...ux-foundation.org,
        mhocko@...e.com, yukuai3@...wei.com, linux-block@...r.kernel.org,
        linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 09/10] block: panic if block debugfs dir is not created

On Sun, Apr 19, 2020 at 07:45:28PM +0000, Luis Chamberlain wrote:
> If DEBUG_FS is disabled we have another inline
> blk_debugfs_register() which just returns 0.
> 
> If BLK_DEV_IO_TRACE is enabled we rely on the block debugfs
> directory to have been created. If BLK_DEV_IO_TRACE is not enabled
> though, but if debugfs is still enabled we will always create a
> debugfs directory for a request_queue. Instead of special-casing
> this just for BLK_DEV_IO_TRACE, ensure this block debugfs dir is
> always created at boot if we have enabled debugfs.
> 
> Signed-off-by: Luis Chamberlain <mcgrof@...nel.org>
> ---
>  block/blk-debugfs.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/block/blk-debugfs.c b/block/blk-debugfs.c
> index 761318dcbf40..d6ec980e7531 100644
> --- a/block/blk-debugfs.c
> +++ b/block/blk-debugfs.c
> @@ -15,6 +15,8 @@ struct dentry *blk_debugfs_root;
>  void blk_debugfs_register(void)
>  {
>  	blk_debugfs_root = debugfs_create_dir("block", NULL);
> +	if (!blk_debugfs_root)
> +		panic("Failed to create block debugfs directory\n");

How rude, never crash the kernel for something so trivial as that.

Heck, never do ANYTHING different in the kernel if debugfs fails to do
something you think it should do.  This is debugging code, nothing
should ever depend on it, so just save the value (if you need it) and
move on.  Never check the value, as it means nothing to you.

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ