diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-11-30 12:42:34 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-11-30 13:18:49 -0500 |
commit | 37a09f07459753e7c98d4e21f1c61e8756923f81 (patch) | |
tree | eecab05dc4b4c2de61f4b31f51d301fdcf210737 | |
parent | e8a7e48bb248a1196484d3f8afa53bded2b24e71 (diff) |
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: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/nfs/dir.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 8ea4a4180a87..f0a384e2ae63 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -395,13 +395,9 @@ int xdr_decode(nfs_readdir_descriptor_t *desc, struct nfs_entry *entry, struct x | |||
395 | static | 395 | static |
396 | int nfs_same_file(struct dentry *dentry, struct nfs_entry *entry) | 396 | int nfs_same_file(struct dentry *dentry, struct nfs_entry *entry) |
397 | { | 397 | { |
398 | struct nfs_inode *node; | ||
399 | if (dentry->d_inode == NULL) | 398 | if (dentry->d_inode == NULL) |
400 | goto different; | 399 | goto different; |
401 | node = NFS_I(dentry->d_inode); | 400 | if (nfs_compare_fh(entry->fh, NFS_FH(dentry->d_inode)) != 0) |
402 | if (node->fh.size != entry->fh->size) | ||
403 | goto different; | ||
404 | if (strncmp(node->fh.data, entry->fh->data, node->fh.size) != 0) | ||
405 | goto different; | 401 | goto different; |
406 | return 1; | 402 | return 1; |
407 | different: | 403 | different: |