aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2007-01-26 03:56:59 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-01-26 16:50:59 -0500
commit250f3915183d377d36e012bac9caa7345ce465b8 (patch)
treee7fd20dfa79a8b4f6435083bf48f4cd3d1836cbf /fs
parent1a8eff6d977c28162c61c9532ca58634e7090b69 (diff)
[PATCH] knfsd: fix an NFSD bug with full sized, non-page-aligned reads
NFSd assumes that largest number of pages that will be needed for a request+response is 2+N where N pages is the size of the largest permitted read/write request. The '2' are 1 for the non-data part of the request, and 1 for the non-data part of the reply. However, when a read request is not page-aligned, and we choose to use ->sendfile to send it directly from the page cache, we may need N+1 pages to hold the whole reply. This can overflow and array and cause an Oops. This patch increases size of the array for holding pages by one and makes sure that entry is NULL when it is not in use. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/vfs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 7a79c23aa6d4..ea855629a1c2 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -822,7 +822,8 @@ nfsd_read_actor(read_descriptor_t *desc, struct page *page, unsigned long offset
822 rqstp->rq_res.page_len = size; 822 rqstp->rq_res.page_len = size;
823 } else if (page != pp[-1]) { 823 } else if (page != pp[-1]) {
824 get_page(page); 824 get_page(page);
825 put_page(*pp); 825 if (*pp)
826 put_page(*pp);
826 *pp = page; 827 *pp = page;
827 rqstp->rq_resused++; 828 rqstp->rq_resused++;
828 rqstp->rq_res.page_len += size; 829 rqstp->rq_res.page_len += size;