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]
Date:   Tue, 28 Apr 2020 21:38:11 -0500
From:   Eric Sandeen <sandeen@...deen.net>
To:     Lukas Czerner <lczerner@...hat.com>, linux-ext4@...r.kernel.org
Cc:     dhowells@...hat.com, viro@...iv.linux.org.uk
Subject: Re: [PATCH v2 05/17] ext4: Allow sb to be NULL in ext4_msg()

On 4/28/20 11:45 AM, Lukas Czerner wrote:
> At the parsing phase of mount in the new mount api sb will not be
> available so allow sb to be NULL in ext4_msg and use that in
> handle_mount_opt().
> 
> Also change return value to appropriate -EINVAL where needed.
> 
> Signed-off-by: Lukas Czerner <lczerner@...hat.com>
> ---
>  fs/ext4/super.c | 120 +++++++++++++++++++++++++-----------------------
>  1 file changed, 63 insertions(+), 57 deletions(-)
> 
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 2c6fea451d7d..2f7e49bfbf71 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -88,7 +88,7 @@ static void ext4_unregister_li_request(struct super_block *sb);
>  static void ext4_clear_request_list(void);
>  static struct inode *ext4_get_journal_inode(struct super_block *sb,
>  					    unsigned int journal_inum);
> -static int ext4_validate_options(struct super_block *sb);
> +static int ext4_validate_options(struct fs_context *fc);
>  
>  /*
>   * Lock ordering
> @@ -754,13 +754,14 @@ void __ext4_msg(struct super_block *sb,
>  	struct va_format vaf;
>  	va_list args;
>  
> -	if (!___ratelimit(&(EXT4_SB(sb)->s_msg_ratelimit_state), "EXT4-fs"))
> +	if (sb &&
> +	    !___ratelimit(&(EXT4_SB(sb)->s_msg_ratelimit_state), "EXT4-fs"))
>  		return;
>  
>  	va_start(args, fmt);
>  	vaf.fmt = fmt;
>  	vaf.va = &args;
> -	printk("%sEXT4-fs (%s): %pV\n", prefix, sb->s_id, &vaf);
> +	printk("%sEXT4-fs (%s): %pV\n", prefix, sb ? sb->s_id : "n/a", &vaf);

Tiny nitpick, I might drop "n/a" - I'm not sure that makes anything clearer:

"EXT4-fs (n/a): message" seems confusing, but maybe that's just me.

FWIW xfs just removes the s_id print altogether if it's not available, i.e.:

static void
__xfs_printk(
        const char              *level,
        const struct xfs_mount  *mp,
        struct va_format        *vaf)
{
        if (mp && mp->m_super) {
                printk("%sXFS (%s): %pV\n", level, mp->m_super->s_id, vaf);
                return;
        }
        printk("%sXFS: %pV\n", level, vaf);
}

*shrug* up to personal preference I suppose.

Thanks,
-Eric

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ