aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/dir.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2010-11-15 20:26:22 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-11-15 20:44:29 -0500
commitac39612824e1fad8baf82c2841e42b2142af3445 (patch)
tree12a841ca751a50f324dc97963579002943d0c3c9 /fs/nfs/dir.c
parent8cd51a0ccd1beda4482507769887c0be9d70f8c1 (diff)
NFS: readdir shouldn't read beyond the reply returned by the server
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/dir.c')
-rw-r--r--fs/nfs/dir.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index c6ce8af266ed..c9196c9cf5a6 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -573,11 +573,13 @@ int nfs_readdir_xdr_to_array(nfs_readdir_descriptor_t *desc, struct page *page,
573 if (!pages_ptr) 573 if (!pages_ptr)
574 goto out_release_array; 574 goto out_release_array;
575 do { 575 do {
576 unsigned int pglen;
576 status = nfs_readdir_xdr_filler(pages, desc, &entry, file, inode); 577 status = nfs_readdir_xdr_filler(pages, desc, &entry, file, inode);
577 578
578 if (status < 0) 579 if (status < 0)
579 break; 580 break;
580 status = nfs_readdir_page_filler(desc, &entry, pages_ptr, page, array_size * PAGE_SIZE); 581 pglen = status;
582 status = nfs_readdir_page_filler(desc, &entry, pages_ptr, page, pglen);
581 if (status < 0) { 583 if (status < 0) {
582 if (status == -ENOSPC) 584 if (status == -ENOSPC)
583 status = 0; 585 status = 0;