Commit 9b83c771 authored by Dan Carpenter's avatar Dan Carpenter Committed by 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: default avatarDan Carpenter <error27@gmail.com>
[v1: Redid the loop a bit]
Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
parent 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%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment