[dm-devel] [PATCH 3/3] dm-ioctl: Don't allow multiple device specifiers

Mikulas Patocka mpatocka at redhat.com
Fri Jul 1 19:05:48 UTC 2011


dm-ioctl: Don't allow multiple device specifiers

Exactly one of name, uuid, device has to be specified.

Signed-off-by: Mikulas Patocka <mpatocka at redhat.com>

---
 drivers/md/dm-ioctl.c |    6 ++++++
 1 file changed, 6 insertions(+)

Index: linux-2.6.39-fast/drivers/md/dm-ioctl.c
===================================================================
--- linux-2.6.39-fast.orig/drivers/md/dm-ioctl.c	2011-07-01 19:52:31.000000000 +0200
+++ linux-2.6.39-fast/drivers/md/dm-ioctl.c	2011-07-01 19:53:04.000000000 +0200
@@ -739,10 +739,16 @@ static struct hash_cell *__find_device_h
 	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;




More information about the dm-devel mailing list