From c7a2bd19b7c1e0bd2c7604c53d2583e91e536948 Mon Sep 17 00:00:00 2001 From: Takahiro Yasui Date: Tue, 6 Jan 2009 03:04:56 +0000 Subject: [RHEL5.7 PATCH] dm log: fix dm_io_client leak on error paths Upstream commit c7a2bd19b7c1e0bd2c7604c53d2583e91e536948 Author: Takahiro Yasui Date: Tue Jan 6 03:04:56 2009 +0000 dm log: fix dm_io_client leak on error paths In create_log_context function, dm_io_client_destroy function needs to be called, when memory allocation of disk_header, sync_bits and recovering_bits failed, but dm_io_client_destroy is not called. Cc: stable@kernel.org Signed-off-by: Takahiro Yasui Acked-by: Jonathan Brassow Signed-off-by: Alasdair G Kergon --- drivers/md/dm-log.c | 5 +++++ 1 file changed, 5 insertions(+) Index: linux-rhel5/drivers/md/dm-log.c =================================================================== --- linux-rhel5.orig/drivers/md/dm-log.c +++ linux-rhel5/drivers/md/dm-log.c @@ -490,6 +490,7 @@ static int create_log_context(struct dm_ lc->disk_header = vmalloc(buf_size); if (!lc->disk_header) { DMWARN("couldn't allocate disk log buffer"); + dm_io_client_destroy(lc->io_req.client); kfree(lc); return -ENOMEM; } @@ -505,6 +506,8 @@ static int create_log_context(struct dm_ DMWARN("couldn't allocate sync bitset"); if (!dev) vfree(lc->clean_bits); + else + dm_io_client_destroy(lc->io_req.client); vfree(lc->disk_header); kfree(lc); return -ENOMEM; @@ -518,6 +521,8 @@ static int create_log_context(struct dm_ vfree(lc->sync_bits); if (!dev) vfree(lc->clean_bits); + else + dm_io_client_destroy(lc->io_req.client); vfree(lc->disk_header); kfree(lc); return -ENOMEM;