aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-thin.c
diff options
context:
space:
mode:
authorJoe Thornber <ejt@redhat.com>2012-07-27 10:08:05 -0400
committerAlasdair G Kergon <agk@redhat.com>2012-07-27 10:08:05 -0400
commit905386f82d08f66726912f303f3e6605248c60a3 (patch)
tree183673431e4a0b76b90488447287cdcf53e1b695 /drivers/md/dm-thin.c
parentc66029f4d4226452e9a7f468650aa1d553525b81 (diff)
dm thin: fix memory leak in process_prepared_mapping error paths
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> Cc: stable@vger.kernel.org Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-thin.c')
-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 93e3e542cff9..423df92f1c19 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -870,7 +870,7 @@ static void process_prepared_mapping(struct dm_thin_new_mapping *m)
870 870
871 if (m->err) { 871 if (m->err) {
872 cell_error(m->cell); 872 cell_error(m->cell);
873 return; 873 goto out;
874 } 874 }
875 875
876 /* 876 /*
@@ -882,7 +882,7 @@ static void process_prepared_mapping(struct dm_thin_new_mapping *m)
882 if (r) { 882 if (r) {
883 DMERR("dm_thin_insert_block() failed"); 883 DMERR("dm_thin_insert_block() failed");
884 cell_error(m->cell); 884 cell_error(m->cell);
885 return; 885 goto out;
886 } 886 }
887 887
888 /* 888 /*
@@ -897,6 +897,7 @@ static void process_prepared_mapping(struct dm_thin_new_mapping *m)
897 } else 897 } else
898 cell_defer(tc, m->cell, m->data_block); 898 cell_defer(tc, m->cell, m->data_block);
899 899
900out:
900 list_del(&m->list); 901 list_del(&m->list);
901 mempool_free(m, tc->pool->mapping_pool); 902 mempool_free(m, tc->pool->mapping_pool);
902} 903}