lightnvm: fix memory leak when submit fails
authorPan Bian <bianpan2016@163.com>
Thu, 21 Jan 2021 07:22:02 +0000 (23:22 -0800)
committerJens Axboe <axboe@kernel.dk>
Thu, 21 Jan 2021 12:45:51 +0000 (05:45 -0700)
commit97784481757fba7570121a70dd37ca74a29f50a8
treeccee7ca08a90a00af966d2a6a87d862b2dd32519
parent1df35bf0b4e17322ec67e88b86ba21a17f904069
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: aff3fb18f957 ("lightnvm: move bad block and chunk state logic to core")
Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/lightnvm/core.c