]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Fix a memory leak inadvertently introduced during simplification of
authorAlasdair G Kergon <agk@redhat.com>
Fri, 13 Apr 2012 00:20:47 +0000 (10:20 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 13 Apr 2012 00:20:47 +0000 (10:20 +1000)
cell_release_singleton() in commit 6f94a4c45a6f744383f9f695dde019998db3df55
("dm thin: fix stacked bi_next usage").

A cell's hlist_del() must be accompanied by a mempool_free().

Signed-off-by: Alasdair G Kergon <agk@redhat.com>
drivers/md/dm-thin.c

index 213ae32a0fc4f7eadacb923a5f1f2ac69163f5c7..7218882964207012700a9662114208e061920077 100644 (file)
@@ -303,9 +303,13 @@ static void cell_release(struct cell *cell, struct bio_list *bios)
  */
 static void __cell_release_singleton(struct cell *cell, struct bio *bio)
 {
-       hlist_del(&cell->list);
+       struct bio_prison *prison = cell->prison;
+
        BUG_ON(cell->holder != bio);
        BUG_ON(!bio_list_empty(&cell->bios));
+
+       hlist_del(&cell->list);
+       mempool_free(cell, prison->cell_pool);
 }
 
 static void cell_release_singleton(struct cell *cell, struct bio *bio)