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:	Thu, 14 Nov 2013 12:19:48 +0200
From:	"Kirill A. Shutemov" <kirill@...temov.name>
To:	Axel Lin <axel.lin@...ics.com>
Cc:	Al Viro <viro@...iv.linux.org.uk>, Rob Landley <rob@...dley.net>,
	Andrew Morton <akpm@...ux-foundation.org>,
	"Eric W. Biederman" <ebiederm@...ssion.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ramfs: Fix memory leak on ramfs_fill_super error paths

On Thu, Nov 14, 2013 at 02:59:19PM +0800, Axel Lin wrote:
> The memory leak was introduced by commit 318ceed0884
> "tidy up after d_make_root() conversion".
> 
> Signed-off-by: Axel Lin <axel.lin@...ics.com>
> ---
>  fs/ramfs/inode.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
> index 39d1465..868a41e 100644
> --- a/fs/ramfs/inode.c
> +++ b/fs/ramfs/inode.c
> @@ -221,7 +221,7 @@ int ramfs_fill_super(struct super_block *sb, void *data, int silent)
>  
>  	err = ramfs_parse_options(data, &fsi->mount_opts);
>  	if (err)
> -		return err;
> +		goto fail;
>  
>  	sb->s_maxbytes		= MAX_LFS_FILESIZE;
>  	sb->s_blocksize		= PAGE_CACHE_SIZE;
> @@ -232,10 +232,16 @@ int ramfs_fill_super(struct super_block *sb, void *data, int silent)
>  
>  	inode = ramfs_get_inode(sb, NULL, S_IFDIR | fsi->mount_opts.mode, 0);
>  	sb->s_root = d_make_root(inode);
> -	if (!sb->s_root)
> -		return -ENOMEM;
> +	if (!sb->s_root) {
> +		err = -ENOMEM;
> +		goto fail;
> +	}
>  
>  	return 0;
> +fail:
> +	kfree(fsi);
> +	sb->s_fs_info = NULL;

Why do we need this?
mount_nodev() seems just drop super block if filler fails.

> +	return err;
>  }
>  
>  struct dentry *ramfs_mount(struct file_system_type *fs_type,
-- 
 Kirill A. Shutemov
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ