]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Block overwriting existing links while manual assembly
authorKinga Tanska <kinga.tanska@intel.com>
Fri, 29 May 2020 06:31:36 +0000 (08:31 +0200)
committerJes Sorensen <jsorensen@fb.com>
Fri, 5 Jun 2020 15:20:49 +0000 (11:20 -0400)
Manual assembly with existing link caused overwriting
this link. Add checking link and block this situation.

Signed-off-by: Kinga Tanska <kinga.tanska@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Assemble.c

index 3e5d4e62af395fd8769a2d5d36c77c3b4c106eff..ed0ddfb1d3d5f8e56efa0d8ecac3c8aa4fe46221 100644 (file)
@@ -1482,6 +1482,10 @@ try_again:
                                name = content->name;
                        break;
                }
+               if (mddev && map_by_name(&map, mddev) != NULL) {
+                       pr_err("Cannot create device with %s because is in use\n", mddev);
+                       goto out;
+               }
                if (!auto_assem)
                        /* If the array is listed in mdadm.conf or on
                         * command line, then we trust the name