From: Kinga Tanska Date: Fri, 29 May 2020 06:31:36 +0000 (+0200) Subject: Block overwriting existing links while manual assembly X-Git-Tag: mdadm-4.2-rc1~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7758ada9f3872cc9cb4c76c733dbc553562b3d7d;p=thirdparty%2Fmdadm.git Block overwriting existing links while manual assembly Manual assembly with existing link caused overwriting this link. Add checking link and block this situation. Signed-off-by: Kinga Tanska Signed-off-by: Jes Sorensen --- diff --git a/Assemble.c b/Assemble.c index 3e5d4e62..ed0ddfb1 100644 --- a/Assemble.c +++ b/Assemble.c @@ -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