Skip to content

Commit

Permalink
pnfsblock: fix NULL pointer dereference
Browse files Browse the repository at this point in the history
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: Peng Tao <[email protected]>
Signed-off-by: Jim Rees <[email protected]>
Cc: [email protected] [3.0]
Signed-off-by: Trond Myklebust <[email protected]>
  • Loading branch information
bergwolf authored and Trond Myklebust committed Oct 18, 2011
1 parent 9b7eecd commit e6d05a7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/nfs/blocklayout/blocklayout.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ bl_read_pagelist(struct nfs_read_data *rdata)
bl_end_io_read, par);
if (IS_ERR(bio)) {
rdata->pnfs_error = PTR_ERR(bio);
bio = NULL;
goto out;
}
}
Expand Down Expand Up @@ -581,6 +582,7 @@ bl_write_pagelist(struct nfs_write_data *wdata, int sync)
bl_end_io_write_zero, par);
if (IS_ERR(bio)) {
wdata->pnfs_error = PTR_ERR(bio);
bio = NULL;
goto out;
}
/* FIXME: This should be done in bi_end_io */
Expand Down Expand Up @@ -629,6 +631,7 @@ bl_write_pagelist(struct nfs_write_data *wdata, int sync)
bl_end_io_write, par);
if (IS_ERR(bio)) {
wdata->pnfs_error = PTR_ERR(bio);
bio = NULL;
goto out;
}
isect += PAGE_CACHE_SECTORS;
Expand Down

0 comments on commit e6d05a7

Please sign in to comment.