Skip to content

Commit

Permalink
lightnvm: fix partial read error path
Browse files Browse the repository at this point in the history
When error occurs during bio_add_page on partial read path, pblk
tries to free pages twice.

Signed-off-by: Igor Konopko <igor.j.konopko@intel.com>
Signed-off-by: Marcin Dziegielewski <marcin.dziegielewski@intel.com>
Signed-off-by: Matias Bjørling <mb@lightnvm.io>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Igor Konopko authored and Jens Axboe committed Jun 1, 2018
1 parent f142ac0 commit fbadca7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/lightnvm/pblk-read.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ static int pblk_partial_read_bio(struct pblk *pblk, struct nvm_rq *rqd,
new_bio = bio_alloc(GFP_KERNEL, nr_holes);

if (pblk_bio_add_pages(pblk, new_bio, GFP_KERNEL, nr_holes))
goto err;
goto err_add_pages;

if (nr_holes != new_bio->bi_vcnt) {
pr_err("pblk: malformed bio\n");
Expand Down Expand Up @@ -347,10 +347,10 @@ static int pblk_partial_read_bio(struct pblk *pblk, struct nvm_rq *rqd,
return NVM_IO_OK;

err:
pr_err("pblk: failed to perform partial read\n");

/* Free allocated pages in new bio */
pblk_bio_free_pages(pblk, bio, 0, new_bio->bi_vcnt);
pblk_bio_free_pages(pblk, new_bio, 0, new_bio->bi_vcnt);
err_add_pages:
pr_err("pblk: failed to perform partial read\n");
__pblk_end_io_read(pblk, rqd, false);
return NVM_IO_ERR;
}
Expand Down

0 comments on commit fbadca7

Please sign in to comment.