]> sourceware.org Git - lvm2.git/commitdiff
device_mapper: zero only secure buffers
authorZdenek Kabelac <zkabelac@redhat.com>
Sat, 27 Feb 2021 16:08:26 +0000 (17:08 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Tue, 2 Mar 2021 21:56:32 +0000 (22:56 +0100)
Securely erase before free() only dm_tasks marked as secure_data.
TODO: think about also using this for libdm/.

device_mapper/ioctl/libdm-iface.c

index 1140798e675a7d462caab064fcb13c63fd908f31..116fa3dc152f2c7cfdc580ce9a91e67a5facb9e0 100644 (file)
@@ -493,7 +493,10 @@ static void _dm_task_free_targets(struct dm_task *dmt)
 
        for (t = dmt->head; t; t = n) {
                n = t->next;
-               _dm_zfree_string(t->params);
+               if (dmt->secure_data)
+                       _dm_zfree_string(t->params);
+               else
+                       free(t->params);
                free(t->type);
                free(t);
        }
@@ -504,7 +507,10 @@ static void _dm_task_free_targets(struct dm_task *dmt)
 void dm_task_destroy(struct dm_task *dmt)
 {
        _dm_task_free_targets(dmt);
-       _dm_zfree_dmi(dmt->dmi.v4);
+       if (dmt->secure_data)
+               _dm_zfree_dmi(dmt->dmi.v4);
+       else
+               free(dmt->dmi.v4);
        free(dmt->dev_name);
        free(dmt->mangled_dev_name);
        free(dmt->newname);
This page took 0.037689 seconds and 5 git commands to generate.