dm persistent data: fix shadow_info_leak on dm_tm_destroy
authorMike Snitzer <snitzer@redhat.com>
Tue, 3 Jul 2012 11:55:33 +0000 (12:55 +0100)
committerAlasdair G Kergon <agk@redhat.com>
Tue, 3 Jul 2012 11:55:33 +0000 (12:55 +0100)
Cleanup the shadow table before destroying the transaction manager.

Reference: leak was identified with kmemleak when running
test_discard_random_sectors in the thinp-test-suite.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
drivers/md/persistent-data/dm-transaction-manager.c

index 400fe144c0cd1c94dd5c325c5ed690a425b7ece3..02bf78e9d10d9080480914f4814a6a94bcbe7ee6 100644 (file)
@@ -138,6 +138,9 @@ EXPORT_SYMBOL_GPL(dm_tm_create_non_blocking_clone);
 
 void dm_tm_destroy(struct dm_transaction_manager *tm)
 {
+       if (!tm->is_clone)
+               wipe_shadow_table(tm);
+
        kfree(tm);
 }
 EXPORT_SYMBOL_GPL(dm_tm_destroy);