NFS: Fix a readdirplus bug
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Tue, 30 Nov 2010 17:42:34 +0000 (12:42 -0500)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 30 Nov 2010 18:18:49 +0000 (10:18 -0800)
When comparing filehandles in the helper nfs_same_file(), we should not be
using 'strncmp()': filehandles are not null terminated strings.

Instead, we should just use the existing helper nfs_compare_fh().

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/nfs/dir.c

index 8ea4a4180a8739f4a80baa2548d9ee004cfbd32e..f0a384e2ae633a1dc2de619d102d5935ff32a273 100644 (file)
@@ -395,13 +395,9 @@ int xdr_decode(nfs_readdir_descriptor_t *desc, struct nfs_entry *entry, struct x
 static
 int nfs_same_file(struct dentry *dentry, struct nfs_entry *entry)
 {
-       struct nfs_inode *node;
        if (dentry->d_inode == NULL)
                goto different;
-       node = NFS_I(dentry->d_inode);
-       if (node->fh.size != entry->fh->size)
-               goto different;
-       if (strncmp(node->fh.data, entry->fh->data, node->fh.size) != 0)
+       if (nfs_compare_fh(entry->fh, NFS_FH(dentry->d_inode)) != 0)
                goto different;
        return 1;
 different: