]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Fix memory leak in process_prepared_mapping by always freeing
authorJoe Thornber <ejt@redhat.com>
Tue, 24 Jul 2012 23:25:18 +0000 (09:25 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 24 Jul 2012 23:25:18 +0000 (09:25 +1000)
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>
drivers/md/dm-thin.c

index 6d0fb34a0308651c9db858a71a27d9af40c8378f..14adc485abd0d4777d7ce271a3eb28b6245286ba 100644 (file)
@@ -870,7 +870,7 @@ static void process_prepared_mapping(struct dm_thin_new_mapping *m)
 
        if (m->err) {
                cell_error(m->cell);
-               return;
+               goto out;
        }
 
        /*
@@ -882,7 +882,7 @@ static void process_prepared_mapping(struct dm_thin_new_mapping *m)
        if (r) {
                DMERR("dm_thin_insert_block() failed");
                cell_error(m->cell);
-               return;
+               goto out;
        }
 
        /*
@@ -897,6 +897,7 @@ static void process_prepared_mapping(struct dm_thin_new_mapping *m)
        } else
                cell_defer(tc, m->cell, m->data_block);
 
+out:
        list_del(&m->list);
        mempool_free(m, tc->pool->mapping_pool);
 }