Commit 6bf784fa authored by Bill Rugolsky's avatar Bill Rugolsky Committed by Linus Torvalds

[PATCH] NFS client O_DIRECT error case fix

The NFS direct-io error return path for request sizes greater than
MAX_DIRECTIO_SIZE fails to initialize the returned page struct array
pointer to NULL.

Discovered using AKPM's ext3-tools: odwrite -ko 0 16385 foo
Signed-off-by: default avatarBill Rugolsky <brugolsky@telemetry-investments.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 972145e7
......@@ -72,8 +72,10 @@ nfs_get_user_pages(int rw, unsigned long user_addr, size_t size,
size_t array_size;
/* set an arbitrary limit to prevent arithmetic overflow */
if (size > MAX_DIRECTIO_SIZE)
if (size > MAX_DIRECTIO_SIZE) {
*pages = NULL;
return -EFBIG;
}
page_count = (user_addr + size + PAGE_SIZE - 1) >> PAGE_SHIFT;
page_count -= user_addr >> PAGE_SHIFT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment