]> git.karo-electronics.de Git - karo-tx-linux.git/commit
nfs: don't zero out the rest of the page if we hit the EOF on a DIO READ
authorJeff Layton <jlayton@redhat.com>
Wed, 12 Dec 2012 16:38:44 +0000 (11:38 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Jan 2013 17:18:36 +0000 (09:18 -0800)
commit9883793305d5fbcf79c565f3572ba44d2493f8f5
treeca0e4a6619a6e448462a409657e90852b44d4b47
parent43d1640924a2bd61e5f8ad156930353bd410e36d
nfs: don't zero out the rest of the page if we hit the EOF on a DIO READ

commit 67fad106a219e083c91c79695bd1807dde1bf7b9 upstream.

Eryu provided a test program that would segfault when attempting to read
past the EOF on file that was opened O_DIRECT. The buffer given to the
read() call was on the stack, and when he attempted to read past it it
would scribble over the rest of the stack page.

If we hit the end of the file on a DIO READ request, then we don't want
to zero out the rest of the buffer. These aren't pagecache pages after
all, and there's no guarantee that the buffers that were passed in
represent entire pages.

Reported-by: Eryu Guan <eguan@redhat.com>
Cc: Fred Isaman <iisaman@netapp.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfs/direct.c