Blame SOURCES/0002-Prevent-user-from-using-stop-with-ambiguous-args.patch

112869
From 0530e2e0d8c9ecb5171e70bc48e1a6566f317378 Mon Sep 17 00:00:00 2001
112869
From: Norbert Szulc <norbert.szulc@intel.com>
112869
Date: Wed, 5 May 2021 13:01:02 +0200
112869
Subject: [PATCH 2/2] Prevent user from using --stop with ambiguous args
112869
112869
When both --scan and device name is passed to --stop action,
112869
then is executed only for given device. Scan is ignored.
112869
112869
Block the operation when both --scan and device name are passed.
112869
112869
Signed-off-by: Norbert Szulc <norbert.szulc@intel.com>
112869
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
112869
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
112869
---
112869
 mdadm.c | 5 +++++
112869
 1 file changed, 5 insertions(+)
112869
112869
diff --git a/mdadm.c b/mdadm.c
112869
index 9a4317d..dcc26ba 100644
112869
--- a/mdadm.c
112869
+++ b/mdadm.c
112869
@@ -2041,6 +2041,11 @@ static int misc_list(struct mddev_dev *devlist,
112869
 				rv |= Manage_run(dv->devname, mdfd, c);
112869
 				break;
112869
 			case 'S':
112869
+				if (c->scan) {
112869
+					pr_err("--stop not meaningful with both a --scan assembly and a device name.\n");
112869
+					rv |= 1;
112869
+					break;
112869
+				}
112869
 				rv |= Manage_stop(dv->devname, mdfd, c->verbose, 0);
112869
 				break;
112869
 			case 'o':
112869
-- 
112869
2.7.5
112869