]> git.baikalelectronics.ru Git - kernel.git/commit
lightnvm: avoid memory leak when lun_map kcalloc fails
authorMatias Bjørling <m@bjorling.me>
Fri, 6 May 2016 18:02:59 +0000 (20:02 +0200)
committerJens Axboe <axboe@fb.com>
Fri, 6 May 2016 18:51:10 +0000 (12:51 -0600)
commit12c08c2407c4211adcd15de2e4d7fbc7eb7d19ba
tree1a354500001df077c63e14ba63c29fc43d375fcf
parentf61256b310ee205e811f3337e55bba24740b3ab3
lightnvm: avoid memory leak when lun_map kcalloc fails

A memory leak occurs if the lower page table is initialized and the
following dev->lun_map fails on allocation.

Rearrange the initialization of lower page table to allow dev->lun_map
to fail gracefully without memory leak.

Reviewed by: Johannes Thumshirn <jthumshirn@suse.de>
Move kfree of dev->lun_map to nvm_free()
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/lightnvm/core.c