From: Mikulas Patocka Date: Tue, 2 Aug 2011 11:32:06 +0000 (+0100) Subject: dm ioctl: forbid multiple device specifiers X-Git-Tag: firefly_0821_release~3680^2~4777^2~7 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=759dea204cce9f1fc2a5d00ea25211299fc7a4a0;p=firefly-linux-kernel-4.4.55.git 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 Signed-off-by: Alasdair G Kergon --- 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) 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;