提交 9b83c771 编写于 作者: D Dan Carpenter 提交者: Konrad Rzeszutek Wilk

xen/blkback: potential null dereference in error handling

blkbk->pending_pages can be NULL here so I added a check for it.
Signed-off-by: NDan Carpenter <error27@gmail.com>
[v1: Redid the loop a bit]
Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
上级 6464920a
......@@ -809,11 +809,13 @@ static int __init xen_blkif_init(void)
failed_init:
kfree(blkbk->pending_reqs);
kfree(blkbk->pending_grant_handles);
for (i = 0; i < mmap_pages; i++) {
if (blkbk->pending_pages[i])
__free_page(blkbk->pending_pages[i]);
if (blkbk->pending_pages) {
for (i = 0; i < mmap_pages; i++) {
if (blkbk->pending_pages[i])
__free_page(blkbk->pending_pages[i]);
}
kfree(blkbk->pending_pages);
}
kfree(blkbk->pending_pages);
kfree(blkbk);
blkbk = NULL;
return rc;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册