Commit e6d05a75 authored by Peng Tao's avatar Peng Tao Committed by Trond Myklebust

pnfsblock: fix NULL pointer dereference

bl_add_page_to_bio returns error pointer. bio should be reset to
NULL in failure cases as the out path always calls bl_submit_bio.
Signed-off-by: default avatarPeng Tao <peng_tao@emc.com>
Signed-off-by: default avatarJim Rees <rees@umich.edu>
Cc: stable@kernel.org [3.0]
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 9b7eecdc
...@@ -292,6 +292,7 @@ bl_read_pagelist(struct nfs_read_data *rdata) ...@@ -292,6 +292,7 @@ bl_read_pagelist(struct nfs_read_data *rdata)
bl_end_io_read, par); bl_end_io_read, par);
if (IS_ERR(bio)) { if (IS_ERR(bio)) {
rdata->pnfs_error = PTR_ERR(bio); rdata->pnfs_error = PTR_ERR(bio);
bio = NULL;
goto out; goto out;
} }
} }
...@@ -581,6 +582,7 @@ bl_write_pagelist(struct nfs_write_data *wdata, int sync) ...@@ -581,6 +582,7 @@ bl_write_pagelist(struct nfs_write_data *wdata, int sync)
bl_end_io_write_zero, par); bl_end_io_write_zero, par);
if (IS_ERR(bio)) { if (IS_ERR(bio)) {
wdata->pnfs_error = PTR_ERR(bio); wdata->pnfs_error = PTR_ERR(bio);
bio = NULL;
goto out; goto out;
} }
/* FIXME: This should be done in bi_end_io */ /* FIXME: This should be done in bi_end_io */
...@@ -629,6 +631,7 @@ bl_write_pagelist(struct nfs_write_data *wdata, int sync) ...@@ -629,6 +631,7 @@ bl_write_pagelist(struct nfs_write_data *wdata, int sync)
bl_end_io_write, par); bl_end_io_write, par);
if (IS_ERR(bio)) { if (IS_ERR(bio)) {
wdata->pnfs_error = PTR_ERR(bio); wdata->pnfs_error = PTR_ERR(bio);
bio = NULL;
goto out; goto out;
} }
isect += PAGE_CACHE_SECTORS; isect += PAGE_CACHE_SECTORS;
......
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