[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20110527062701.GK14591@shale.localdomain>
Date: Fri, 27 May 2011 09:27:16 +0300
From: Dan Carpenter <error27@...il.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
Cc: Jan Beulich <jbeulich@...ell.com>,
open list <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: [patch] 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@...il.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);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists