Commit 37a09f07 authored by Trond Myklebust's avatar Trond Myklebust Committed by Linus Torvalds

NFS: Fix a readdirplus bug

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: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e8a7e48b
...@@ -395,13 +395,9 @@ int xdr_decode(nfs_readdir_descriptor_t *desc, struct nfs_entry *entry, struct x ...@@ -395,13 +395,9 @@ int xdr_decode(nfs_readdir_descriptor_t *desc, struct nfs_entry *entry, struct x
static static
int nfs_same_file(struct dentry *dentry, struct nfs_entry *entry) int nfs_same_file(struct dentry *dentry, struct nfs_entry *entry)
{ {
struct nfs_inode *node;
if (dentry->d_inode == NULL) if (dentry->d_inode == NULL)
goto different; goto different;
node = NFS_I(dentry->d_inode); if (nfs_compare_fh(entry->fh, NFS_FH(dentry->d_inode)) != 0)
if (node->fh.size != entry->fh->size)
goto different;
if (strncmp(node->fh.data, entry->fh->data, node->fh.size) != 0)
goto different; goto different;
return 1; return 1;
different: different:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment