bug-parted
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH parted 2/2] linux: Fix use after free in devicemapper code


From: Hans de Goede
Subject: [PATCH parted 2/2] linux: Fix use after free in devicemapper code
Date: Fri, 18 Dec 2009 10:33:18 +0100

* libparted/arch/linux.c (_dm_add_partition): Fix use of dm_task
information after freeing it.
---
 libparted/arch/linux.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 9d15bf2..36a698d 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -2447,12 +2447,14 @@ _dm_add_partition (PedDisk* disk, PedPartition* part)
                 goto err;
 
         dev_name = dm_task_get_name (task);
-        dm_task_destroy (task);
-        task = NULL;
 
         if (asprintf (&vol_name, "%sp%d", dev_name, part->num) == -1)
                 goto err;
 
+        dm_task_destroy(task);
+        dev_name = NULL;
+        task = NULL;
+
         if (asprintf (&params, "%d:%d %lld", arch_specific->major,
                       arch_specific->minor, part->geom.start) == -1)
                 goto err;
-- 
1.6.5.2





reply via email to

[Prev in Thread] Current Thread [Next in Thread]