drivers/lightnvm: fix a null-ptr-deref bug in pblk-core.c
authortangzhenhao <tzh18@mails.tsinghua.edu.cn>
Mon, 30 Nov 2020 07:23:56 +0000 (23:23 -0800)
committerJens Axboe <axboe@kernel.dk>
Tue, 8 Dec 2020 17:02:45 +0000 (10:02 -0700)
commitf87905660ed01d85e45eac22d479f31f380b2f50
treef7921a5f4b1fde5a573a0f91e91b4f2c096bb344
parenteebf34a85c8c724676eba502d15202854f199b05
drivers/lightnvm: fix a null-ptr-deref bug in pblk-core.c

At line 294 in drivers/lightnvm/pblk-write.c, function pblk_gen_run_ws is
called with actual param GFP_ATOMIC. pblk_gen_run_ws call mempool_alloc
using "GFP_ATOMIC" flag, so mempool_alloc can return null. So we need to
check the return-val of mempool_alloc to avoid null-ptr-deref bug.

Signed-off-by: tangzhenhao <tzh18@mails.tsinghua.edu.cn>
Reviewed-by: Matias Bjørling <mb@lightnvm.io>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/lightnvm/pblk-core.c