Skip to content

Commit

Permalink
dm ioctl: forbid multiple device specifiers
Browse files Browse the repository at this point in the history
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: Mikulas Patocka <[email protected]>
Signed-off-by: Alasdair G Kergon <[email protected]>
  • Loading branch information
Mikulas Patocka authored and kergon committed Aug 2, 2011
1 parent ba2e19b commit 759dea2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/md/dm-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -739,10 +739,16 @@ static struct hash_cell *__find_device_hash_cell(struct dm_ioctl *param)
struct hash_cell *hc = NULL;

if (*param->uuid) {
if (*param->name || param->dev)
return NULL;

hc = __get_uuid_cell(param->uuid);
if (!hc)
return NULL;
} else if (*param->name) {
if (param->dev)
return NULL;

hc = __get_name_cell(param->name);
if (!hc)
return NULL;
Expand Down

0 comments on commit 759dea2

Please sign in to comment.