[patch] xen/blkback: potential null dereference in error handling
From: Dan Carpenter
Date: Fri May 27 2011 - 02:27:49 EST
blkbk->pending_pages can be NULL here so I added a check for it.
Signed-off-by: Dan Carpenter <error27@xxxxxxxxx>
---
Perhaps this is not the a very optimized solution, but it's error
handling code so it's not performance critical.
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
index c73910c..1c7a59d 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -810,7 +810,7 @@ static int __init xen_blkif_init(void)
kfree(blkbk->pending_reqs);
kfree(blkbk->pending_grant_handles);
for (i = 0; i < mmap_pages; i++) {
- if (blkbk->pending_pages[i])
+ if (blkbk->pending_pages && blkbk->pending_pages[i])
__free_page(blkbk->pending_pages[i]);
}
kfree(blkbk->pending_pages);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/