* [PATCH] NFS: Fix potential race in nfs_fhget()
@ 2016-06-15 20:05 Trond Myklebust
2016-06-16 14:04 ` Jeff Layton
0 siblings, 1 reply; 2+ messages in thread
From: Trond Myklebust @ 2016-06-15 20:05 UTC (permalink / raw)
To: linux-nfs
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;
}
--
2.5.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] NFS: Fix potential race in nfs_fhget()
2016-06-15 20:05 [PATCH] NFS: Fix potential race in nfs_fhget() Trond Myklebust
@ 2016-06-16 14:04 ` Jeff Layton
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Layton @ 2016-06-16 14:04 UTC (permalink / raw)
To: Trond Myklebust, linux-nfs
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>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-06-16 14:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-15 20:05 [PATCH] NFS: Fix potential race in nfs_fhget() Trond Myklebust
2016-06-16 14:04 ` Jeff Layton
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).