]> git.baikalelectronics.ru Git - kernel.git/commit
[PATCH] knfsd: fix an NFSD bug with full sized, non-page-aligned reads
authorNeilBrown <neilb@suse.de>
Fri, 26 Jan 2007 08:56:59 +0000 (00:56 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Fri, 26 Jan 2007 21:50:59 +0000 (13:50 -0800)
commit70eac7e0210f615260e82556d425dcd5fbf58d54
treee7fd20dfa79a8b4f6435083bf48f4cd3d1836cbf
parent03681515635e37b64a910ce0093f02748af9f3d1
[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>
fs/nfsd/vfs.c
include/linux/sunrpc/svc.h
net/sunrpc/svcsock.c