linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@redhat.com>
To: Trond Myklebust <trond.myklebust@primarydata.com>,
	linux-nfs@vger.kernel.org
Subject: Re: [PATCH] NFS: Fix potential race in nfs_fhget()
Date: Thu, 16 Jun 2016 10:04:15 -0400	[thread overview]
Message-ID: <1466085855.3079.1.camel@redhat.com> (raw)
In-Reply-To: <1466021128-62407-1-git-send-email-trond.myklebust@primarydata.com>

On Wed, 2016-06-15 at 16:05 -0400, Trond Myklebust wrote:
> If we don't set the mode correctly in nfs_init_locked(), then there
> is
> potential for a race with a second call to nfs_fhget that will cause
> inode aliasing.
> 
> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
> ---
>  fs/nfs/inode.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
> index 52e7d6869e3b..dda689d7a8a7 100644
> --- a/fs/nfs/inode.c
> +++ b/fs/nfs/inode.c
> @@ -282,6 +282,7 @@ nfs_init_locked(struct inode *inode, void
> *opaque)
>  	struct nfs_fattr	*fattr = desc->fattr;
>  
>  	set_nfs_fileid(inode, fattr->fileid);
> +	inode->i_mode = fattr->mode;
>  	nfs_copy_fh(NFS_FH(inode), desc->fh);
>  	return 0;
>  }

Good catch!

Reviewed-by: Jeff Layton <jlayton@redhat.com>

      reply	other threads:[~2016-06-16 14:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-15 20:05 [PATCH] NFS: Fix potential race in nfs_fhget() Trond Myklebust
2016-06-16 14:04 ` Jeff Layton [this message]

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=1466085855.3079.1.camel@redhat.com \
    --to=jlayton@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@primarydata.com \
    /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).