mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
eebf34a85c
commit
f87905660e
|
@ -1869,6 +1869,10 @@ void pblk_gen_run_ws(struct pblk *pblk, struct pblk_line *line, void *priv,
|
|||
struct pblk_line_ws *line_ws;
|
||||
|
||||
line_ws = mempool_alloc(&pblk->gen_ws_pool, gfp_mask);
|
||||
if (!line_ws) {
|
||||
pblk_err(pblk, "pblk: could not allocate memory\n");
|
||||
return;
|
||||
}
|
||||
|
||||
line_ws->pblk = pblk;
|
||||
line_ws->line = line;
|
||||
|
|
Loading…
Reference in New Issue