mirror of
https://github.com/torvalds/linux.git
synced 2024-11-15 16:41:58 +00:00
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>
This commit is contained in:
parent
c6c8fe79a8
commit
c1109558ae
@ -947,6 +947,8 @@ static int __nfs_pageio_add_request(struct nfs_pageio_descriptor *desc,
|
|||||||
subreq = nfs_create_request(req->wb_context,
|
subreq = nfs_create_request(req->wb_context,
|
||||||
req->wb_page,
|
req->wb_page,
|
||||||
subreq, pgbase, bytes_left);
|
subreq, pgbase, bytes_left);
|
||||||
|
if (IS_ERR(subreq))
|
||||||
|
goto err_ptr;
|
||||||
nfs_lock_request(subreq);
|
nfs_lock_request(subreq);
|
||||||
subreq->wb_offset = offset;
|
subreq->wb_offset = offset;
|
||||||
subreq->wb_index = req->wb_index;
|
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);
|
nfs_page_group_unlock(req);
|
||||||
return 1;
|
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)
|
static int nfs_do_recoalesce(struct nfs_pageio_descriptor *desc)
|
||||||
|
Loading…
Reference in New Issue
Block a user