summaryrefslogtreecommitdiff
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2014-05-29 19:38:15 +0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2014-05-29 20:12:26 +0400
commitc1109558ae0f07a3434357cd26203bfc7adfea75 (patch)
tree80e443d1c539933a99a05733b18a2937c7a25c1f /fs/nfs
parentc6c8fe79a83e1a03e5dd83d0bac178d6ba5ef30a (diff)
downloadlinux-c1109558ae0f07a3434357cd26203bfc7adfea75.tar.xz
NFS: Fix error handling in __nfs_pageio_add_request
Handle the case where nfs_create_request() returns an error. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/pagelist.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index fab78d13ee14..0b8446f1008d 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -947,6 +947,8 @@ static int __nfs_pageio_add_request(struct nfs_pageio_descriptor *desc,
subreq = nfs_create_request(req->wb_context,
req->wb_page,
subreq, pgbase, bytes_left);
+ if (IS_ERR(subreq))
+ goto err_ptr;
nfs_lock_request(subreq);
subreq->wb_offset = offset;
subreq->wb_index = req->wb_index;
@@ -955,6 +957,10 @@ static int __nfs_pageio_add_request(struct nfs_pageio_descriptor *desc,
nfs_page_group_unlock(req);
return 1;
+err_ptr:
+ desc->pg_error = PTR_ERR(subreq);
+ nfs_page_group_unlock(req);
+ return 0;
}
static int nfs_do_recoalesce(struct nfs_pageio_descriptor *desc)