From: Mike Snitzer Date: Tue, 3 Jul 2012 11:55:33 +0000 (+0100) Subject: dm persistent data: fix shadow_info_leak on dm_tm_destroy X-Git-Tag: v3.2.23~30 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=ee294c7066c9c056a28c6d7b4b024ddf18a80f12;p=karo-tx-linux.git dm persistent data: fix shadow_info_leak on dm_tm_destroy commit 25d7cd6faa7ae6ed2565617c3ee2500ccb8a9f7f upstream. 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 Signed-off-by: Alasdair G Kergon Signed-off-by: Ben Hutchings --- diff --git a/drivers/md/persistent-data/dm-transaction-manager.c b/drivers/md/persistent-data/dm-transaction-manager.c index 6f8d38747d7f..e5902d1f8c14 100644 --- a/drivers/md/persistent-data/dm-transaction-manager.c +++ b/drivers/md/persistent-data/dm-transaction-manager.c @@ -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);