aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-ioctl.c
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2011-08-02 07:32:06 -0400
committerAlasdair G Kergon <agk@redhat.com>2011-08-02 07:32:06 -0400
commit759dea204cce9f1fc2a5d00ea25211299fc7a4a0 (patch)
tree3ddbfdc0c4cb97317ea0d0d7bb6879fcac72b840 /drivers/md/dm-ioctl.c
parentba2e19b0f4ccd6920fe175a86521ff18ede260cb (diff)
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: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-ioctl.c')
-rw-r--r--drivers/md/dm-ioctl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index 4c350914f4a0..2e9a3ca37bdd 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -739,10 +739,16 @@ static struct hash_cell *__find_device_hash_cell(struct dm_ioctl *param)
739 struct hash_cell *hc = NULL; 739 struct hash_cell *hc = NULL;
740 740
741 if (*param->uuid) { 741 if (*param->uuid) {
742 if (*param->name || param->dev)
743 return NULL;
744
742 hc = __get_uuid_cell(param->uuid); 745 hc = __get_uuid_cell(param->uuid);
743 if (!hc) 746 if (!hc)
744 return NULL; 747 return NULL;
745 } else if (*param->name) { 748 } else if (*param->name) {
749 if (param->dev)
750 return NULL;
751
746 hc = __get_name_cell(param->name); 752 hc = __get_name_cell(param->name);
747 if (!hc) 753 if (!hc)
748 return NULL; 754 return NULL;