Commit 97784481 authored by Pan Bian's avatar Pan Bian Committed by Jens Axboe

lightnvm: fix memory leak when submit fails

The allocated page is not released if error occurs in
nvm_submit_io_sync_raw(). __free_page() is moved ealier to avoid
possible memory leak issue.

Fixes: aff3fb18 ("lightnvm: move bad block and chunk state logic to core")
Signed-off-by: default avatarPan Bian <bianpan2016@163.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 1df35bf0
......@@ -844,11 +844,10 @@ static int nvm_bb_chunk_sense(struct nvm_dev *dev, struct ppa_addr ppa)
rqd.ppa_addr = generic_to_dev_addr(dev, ppa);
ret = nvm_submit_io_sync_raw(dev, &rqd);
__free_page(page);
if (ret)
return ret;
__free_page(page);
return rqd.error;
}
......
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