From: Andy Adamson Date: Wed, 16 Jun 2010 13:51:02 +0000 (-0400) Subject: nfs4 use mandatory attribute file type in nfs4_get_root X-Git-Tag: firefly_0821_release~9833^2~1233^2~46 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f799bdb355edaabd81b778087613409a8932fbe9;p=firefly-linux-kernel-4.4.55.git nfs4 use mandatory attribute file type in nfs4_get_root S_ISDIR(fsinfo.fattr->mode) checks the file type rather than the mode bits, so we should be checking for the NFS_ATTR_FATTR_TYPE fattr property. Signed-off-by: Andy Adamson Signed-off-by: Trond Myklebust Cc: stable@kernel.org --- diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c index 7428f7d6273b..a70e446e1605 100644 --- a/fs/nfs/getroot.c +++ b/fs/nfs/getroot.c @@ -146,7 +146,7 @@ int nfs4_get_rootfh(struct nfs_server *server, struct nfs_fh *mntfh) goto out; } - if (!(fsinfo.fattr->valid & NFS_ATTR_FATTR_MODE) + if (!(fsinfo.fattr->valid & NFS_ATTR_FATTR_TYPE) || !S_ISDIR(fsinfo.fattr->mode)) { printk(KERN_ERR "nfs4_get_rootfh:" " getroot encountered non-directory\n");