Commit 759dea20 authored by Mikulas Patocka's avatar Mikulas Patocka Committed by Alasdair G Kergon

dm ioctl: forbid multiple device specifiers

Exactly one of name, uuid or device must be specified when referencing
an existing device.  This removes the ambiguity (risking the wrong
device being updated) if two conflicting parameters were specified.
Previously one parameter got used and any others were ignored silently.
Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
parent ba2e19b0
...@@ -739,10 +739,16 @@ static struct hash_cell *__find_device_hash_cell(struct dm_ioctl *param) ...@@ -739,10 +739,16 @@ static struct hash_cell *__find_device_hash_cell(struct dm_ioctl *param)
struct hash_cell *hc = NULL; struct hash_cell *hc = NULL;
if (*param->uuid) { if (*param->uuid) {
if (*param->name || param->dev)
return NULL;
hc = __get_uuid_cell(param->uuid); hc = __get_uuid_cell(param->uuid);
if (!hc) if (!hc)
return NULL; return NULL;
} else if (*param->name) { } else if (*param->name) {
if (param->dev)
return NULL;
hc = __get_name_cell(param->name); hc = __get_name_cell(param->name);
if (!hc) if (!hc)
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment