]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Prevent user from using --stop with ambiguous args
authorNorbert Szulc <norbert.szulc@intel.com>
Wed, 5 May 2021 11:01:02 +0000 (13:01 +0200)
committerJes Sorensen <jsorensen@fb.com>
Thu, 6 May 2021 21:01:25 +0000 (17:01 -0400)
When both --scan and device name is passed to --stop action,
then is executed only for given device. Scan is ignored.

Block the operation when both --scan and device name are passed.

Signed-off-by: Norbert Szulc <norbert.szulc@intel.com>
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
mdadm.c

diff --git a/mdadm.c b/mdadm.c
index 9a4317d5f4be2c885506ddbbb9a851e01aac6416..dcc26ba8f1a130212449e85d976707860d1f0ec7 100644 (file)
--- a/mdadm.c
+++ b/mdadm.c
@@ -2041,6 +2041,11 @@ static int misc_list(struct mddev_dev *devlist,
                                rv |= Manage_run(dv->devname, mdfd, c);
                                break;
                        case 'S':
+                               if (c->scan) {
+                                       pr_err("--stop not meaningful with both a --scan assembly and a device name.\n");
+                                       rv |= 1;
+                                       break;
+                               }
                                rv |= Manage_stop(dv->devname, mdfd, c->verbose, 0);
                                break;
                        case 'o':