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

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