linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] xen/blkback: potential null dereference in error handling
@ 2011-05-27  6:27 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2011-05-27  6:27 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: Jan Beulich, open list, kernel-janitors

blkbk->pending_pages can be NULL here so I added a check for it.

Signed-off-by: Dan Carpenter <error27@gmail.com>
---
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);

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-05-27  6:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-27  6:27 [patch] xen/blkback: potential null dereference in error handling Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).