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: Dan Carpenter <error27@gmail.com> [v1: Redid the loop a bit] Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
This commit is contained in:
committed by
Konrad Rzeszutek Wilk
parent
6464920a6e
commit
9b83c77121
@@ -809,11 +809,13 @@ static int __init xen_blkif_init(void)
|
|||||||
failed_init:
|
failed_init:
|
||||||
kfree(blkbk->pending_reqs);
|
kfree(blkbk->pending_reqs);
|
||||||
kfree(blkbk->pending_grant_handles);
|
kfree(blkbk->pending_grant_handles);
|
||||||
|
if (blkbk->pending_pages) {
|
||||||
for (i = 0; i < mmap_pages; i++) {
|
for (i = 0; i < mmap_pages; i++) {
|
||||||
if (blkbk->pending_pages[i])
|
if (blkbk->pending_pages[i])
|
||||||
__free_page(blkbk->pending_pages[i]);
|
__free_page(blkbk->pending_pages[i]);
|
||||||
}
|
}
|
||||||
kfree(blkbk->pending_pages);
|
kfree(blkbk->pending_pages);
|
||||||
|
}
|
||||||
kfree(blkbk);
|
kfree(blkbk);
|
||||||
blkbk = NULL;
|
blkbk = NULL;
|
||||||
return rc;
|
return rc;
|
||||||
|
Reference in New Issue
Block a user