From: Vivek Goyal <vgoyal@redhat.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Djalal Harouni <tixxdz@gmail.com>, Chris Mason <clm@fb.com>,
Theodore Tso <tytso@mit.edu>,
Josh Triplett <josh@joshtriplett.org>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Andy Lutomirski <luto@kernel.org>,
Seth Forshee <seth.forshee@canonical.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-security-module@vger.kernel.org,
Dongsu Park <dongsu@endocode.com>,
David Herrmann <dh.herrmann@googlemail.com>,
Miklos Szeredi <mszeredi@redhat.com>,
Alban Crequy <alban.crequy@gmail.com>,
Al Viro <viro@ZenIV.linux.org.uk>,
"Serge E. Hallyn" <serge@hallyn.com>,
Phil Estes <estesp@gmail.com>,
Amir Goldstein <amir73il@gmail.com>
Subject: Re: [RFC v2 1/1] shiftfs: uid/gid shifting bind mount
Date: Wed, 22 Feb 2017 11:41:18 -0500 [thread overview]
Message-ID: <20170222164118.GB14894@redhat.com> (raw)
In-Reply-To: <1487715806.2373.15.camel@HansenPartnership.com>
On Tue, Feb 21, 2017 at 05:23:26PM -0500, James Bottomley wrote:
> On Tue, 2017-02-21 at 11:06 -0500, Vivek Goyal wrote:
> > On Mon, Feb 20, 2017 at 04:47:05PM -0800, James Bottomley wrote:
> >
> > [..]
> > > +static struct dentry *shiftfs_lookup(struct inode *dir, struct
> > > dentry *dentry,
> > > + unsigned int flags)
> > > +{
> > > + struct dentry *real = dir->i_private, *new;
> > > + struct inode *reali = real->d_inode, *newi;
> >
> > newi needs to be initialized to NULL. Otherwise if a file does not
> > exist, we try to call d_splice_alias() with uninitialized value of
> > newi.
> >
> > This crashes for the new file creation case.
>
> I think you've still got an older version. The code around that region
> should read:
>
>
>
> oldcred = shiftfs_new_creds(&newcred, dentry->d_sb);
> new = lookup_one_len(dentry->d_name.name, real, dentry->d_name.len);
> shiftfs_old_creds(oldcred, &newcred);
> inode_unlock(reali);
>
> if (IS_ERR(new))
> return new;
>
> dentry->d_fsdata = new;
>
> newi = NULL;
> if (!new->d_inode)
> goto out;
>
> newi = shiftfs_new_inode(dentry->d_sb, new->d_inode->i_mode, new);
> if (!newi) {
> dput(new);
> return ERR_PTR(-ENOMEM);
> }
>
> out:
> return d_splice_alias(newi, dentry);
>
> So newi is set to NULL before out is taken. I checked: this hunk did make it to the v2 patch.
Aha.., you are right. I did not pay attention of newi=NULL in V2 and went
on to provide feeback based on my V1 testing.
Vivek
next prev parent reply other threads:[~2017-02-22 16:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-21 0:45 [RFC v2 0/1] shiftfs: uid/gid shifting filesystem (s_user_ns version) James Bottomley
2017-02-21 0:47 ` [RFC v2 1/1] shiftfs: uid/gid shifting bind mount James Bottomley
2017-02-21 16:06 ` Vivek Goyal
2017-02-21 22:23 ` James Bottomley
2017-02-22 16:41 ` Vivek Goyal [this message]
2017-03-02 17:06 ` Vivek Goyal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170222164118.GB14894@redhat.com \
--to=vgoyal@redhat.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=alban.crequy@gmail.com \
--cc=amir73il@gmail.com \
--cc=clm@fb.com \
--cc=dh.herrmann@googlemail.com \
--cc=dongsu@endocode.com \
--cc=ebiederm@xmission.com \
--cc=estesp@gmail.com \
--cc=josh@joshtriplett.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mszeredi@redhat.com \
--cc=serge@hallyn.com \
--cc=seth.forshee@canonical.com \
--cc=tixxdz@gmail.com \
--cc=tytso@mit.edu \
--cc=viro@ZenIV.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).