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, 07 Jun 2018 21:45:29 +0100
From:   David Howells <dhowells@...hat.com>
To:     Goldwyn Rodrigues <rgoldwyn@...e.de>
Cc:     dhowells@...hat.com, viro@...iv.linux.org.uk,
        linux-fsdevel@...r.kernel.org, linux-afs@...ts.infradead.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 26/32] afs: Use fs_context to pass parameters over automount [ver #8]

Goldwyn Rodrigues <rgoldwyn@...e.de> wrote:

Goldwyn Rodrigues <rgoldwyn@...e.de> wrote:

> > +static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt)
> > +{
> > +	struct fs_context *fc;
> > +	struct vfsmount *mnt;
> > +	int ret;
> > +
> > +	BUG_ON(!d_inode(mntpt));
> > +
> > +	fc = vfs_new_fs_context(&afs_fs_type, mntpt, 0,
> > +				FS_CONTEXT_FOR_SUBMOUNT);
> > +	if (IS_ERR(fc))
> > +		return ERR_CAST(fc);
> > +
> > +	ret = afs_mntpt_set_params(fc, mntpt);
> > +	if (ret < 0)
> > +		goto error_fc;
> > +
> > +	ret = vfs_get_tree(fc);
> > +	if (ret < 0)
> > +		goto error_fc;
> > +
> > +	mnt = vfs_create_mount(fc, 0);
> > +	if (IS_ERR(mnt)) {
> > +		ret = PTR_ERR(mnt);
> > +		goto error_fc;
> > +	}
> >  
> > -	free_page((unsigned long) devname);
> > -	free_page((unsigned long) options);
> > -	_leave(" = %p", mnt);
> > +	put_fs_context(fc);
> >  	return mnt;
> >  
> Why are you performing a put_fs_context(fc) in the success code path? Do
> we not need a reference of fc anymore?

No.  This is the ->d_automount() hook.  The context is created at the top of
the function, configuration is done, the superblock is obtained, a mount
object is created (for which we get a ref returned).  After that point, we
don't need the context any more and no one else is going to clean it up for
us.

David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ