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:   Wed, 19 Sep 2018 10:15:19 +0900
From:   Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
To:     David Howells <dhowells@...hat.com>
Cc:     Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
        Guenter Roeck <linux@...ck-us.net>, viro@...iv.linux.org.uk,
        torvalds@...ux-foundation.org, linux-fsdevel@...r.kernel.org,
        linux-kernel@...r.kernel.org, Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [PATCH 14/33] vfs: Implement a filesystem superblock
 creation/configuration context [ver #11]

On (09/18/18 17:39), David Howells wrote:
[..]
> -static int legacy_init_fs_context(struct fs_context *fc, struct dentry *dentry)
> +int legacy_init_fs_context(struct fs_context *fc, struct dentry *dentry)
>  {
> +	switch (fc->purpose) {
> +	default:
> +		fc->fs_private = kzalloc(sizeof(struct legacy_fs_context),
> +					 GFP_KERNEL);
> +		if (!fc->fs_private)
> +			return -ENOMEM;

ops->reconfigure() invoked for FS_CONTEXT_FOR_UMOUNT or
FS_CONTEXT_FOR_EMERGENCY_RO will never access fc->fs_private?

> +		break;
>  
> -	fc->fs_private = kzalloc(sizeof(struct legacy_fs_context), GFP_KERNEL);
> -	if (!fc->fs_private)
> -		return -ENOMEM;
> +	case FS_CONTEXT_FOR_UMOUNT:
> +	case FS_CONTEXT_FOR_EMERGENCY_RO:
> +		break;
> +	}

So `fc' can either be zeroed-out, when it comes from fc = kzalloc(),
or contain some garbage otherwise. Would it make sense to zero-out `fc'
regardless of its origin?

>  	down_write(&sb->s_umount);
> -	if (!sb_rdonly(sb))
> -		/* Might want to call ->init_fs_context(). */
> -		ret = reconfigure_super(&fc);
> +	if (!sb_rdonly(sb)) {
> +		int ret;
> +
> +		if (fc.fs_type->init_fs_context)
> +			ret = fc.fs_type->init_fs_context(&fc, NULL);
> +		else
> +			ret = legacy_init_fs_context(&fc, NULL);
> +
> +		if (ret == 0) {
> +			ret = reconfigure_super(&fc);
> +			fc.ops->free(&fc);
			^^^^^^^
Is ops->free() always !NULL?

	-ss

Powered by blists - more mailing lists