summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Thornber <ejt@redhat.com>2012-07-27 15:08:05 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-08-09 08:31:40 -0700
commite73b09d8f258df200adb6383c77c38c31f6f4baa (patch)
tree5d67fdbc9e8636156681f69bf46d61a5ab6a1e45
parentb4ce163953a4baab2341ba42386904a7199d11af (diff)
downloadlwn-e73b09d8f258df200adb6383c77c38c31f6f4baa.tar.gz
lwn-e73b09d8f258df200adb6383c77c38c31f6f4baa.zip
dm thin: fix memory leak in process_prepared_mapping error paths
commit 905386f82d08f66726912f303f3e6605248c60a3 upstream. Fix memory leak in process_prepared_mapping by always freeing the dm_thin_new_mapping structs from the mapping_pool mempool on the error paths. Signed-off-by: Joe Thornber <ejt@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/md/dm-thin.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index bbb29ccc24c7..1555f0b2a2be 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -855,7 +855,7 @@ static void process_prepared_mapping(struct new_mapping *m)
if (m->err) {
cell_error(m->cell);
- return;
+ goto out;
}
/*
@@ -867,7 +867,7 @@ static void process_prepared_mapping(struct new_mapping *m)
if (r) {
DMERR("dm_thin_insert_block() failed");
cell_error(m->cell);
- return;
+ goto out;
}
/*
@@ -882,6 +882,7 @@ static void process_prepared_mapping(struct new_mapping *m)
} else
cell_defer(tc, m->cell, m->data_block);
+out:
list_del(&m->list);
mempool_free(m, tc->pool->mapping_pool);
}