Commit 759dea204cce9f1fc2a5d00ea25211299fc7a4a0
Committed by
Alasdair G Kergon
1 parent
ba2e19b0f4
Exists in
master
and in
6 other branches
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>
Showing 1 changed file with 6 additions and 0 deletions Side-by-side Diff
drivers/md/dm-ioctl.c
... | ... | @@ -739,10 +739,16 @@ |
739 | 739 | struct hash_cell *hc = NULL; |
740 | 740 | |
741 | 741 | if (*param->uuid) { |
742 | + if (*param->name || param->dev) | |
743 | + return NULL; | |
744 | + | |
742 | 745 | hc = __get_uuid_cell(param->uuid); |
743 | 746 | if (!hc) |
744 | 747 | return NULL; |
745 | 748 | } else if (*param->name) { |
749 | + if (param->dev) | |
750 | + return NULL; | |
751 | + | |
746 | 752 | hc = __get_name_cell(param->name); |
747 | 753 | if (!hc) |
748 | 754 | return NULL; |