summaryrefslogtreecommitdiff
path: root/device_mapper/ioctl
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2018-11-16 15:54:09 +0100
committerZdenek Kabelac <zkabelac@redhat.com>2018-11-17 00:30:50 +0100
commit10e191fd124e89d40518a7cba5d61c47be5a0969 (patch)
tree2aa51808ab36ed582b6c18ae9cdb05e41cb6a123 /device_mapper/ioctl
parentd44bfe90f1b609d23566ba26c4d51ba167f2368d (diff)
downloadlvm2-10e191fd124e89d40518a7cba5d61c47be5a0969.tar.gz
libdm: do not add params for resume and remove
DM_DEVICE_CREATE with table is doing several ioctl operations, however only some of then takes parameters. Since _create_and_load_v4() reused already existing dm task from DM_DEVICE_RELOAD it has also kept passing its table parameters to DM_DEVICE_RESUME ioctl - but this ioctl is supposed to not take any argument and thus there is no wiping of passed data - and since kernel returns buffer and shortens dmi->data_size accordingly, anything past returned data size remained uncleared in zfree() function. This has problem if the user used dm_task_secure_data (i.e. cryptsetup), as in this case binary expact secured data are erased from main memory after use, but they may have been left in place. This patch is also closing the possible hole for error path, which also reuse same dm task structure for DM_DEVICE_REMOVE.
Diffstat (limited to 'device_mapper/ioctl')
-rw-r--r--device_mapper/ioctl/libdm-iface.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/device_mapper/ioctl/libdm-iface.c b/device_mapper/ioctl/libdm-iface.c
index 27db6225a..cc69317d3 100644
--- a/device_mapper/ioctl/libdm-iface.c
+++ b/device_mapper/ioctl/libdm-iface.c
@@ -1454,6 +1454,7 @@ static int _create_and_load_v4(struct dm_task *dmt)
dmt->uuid = NULL;
free(dmt->mangled_uuid);
dmt->mangled_uuid = NULL;
+ _dm_task_free_targets(dmt);
if (dm_task_run(dmt))
return 1;
@@ -1464,6 +1465,7 @@ static int _create_and_load_v4(struct dm_task *dmt)
dmt->uuid = NULL;
free(dmt->mangled_uuid);
dmt->mangled_uuid = NULL;
+ _dm_task_free_targets(dmt);
/*
* Also udev-synchronize "remove" dm task that is a part of this revert!