dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/0082-Block-overwriting-existing-links-while-manual-assemb.patch

3c4af5
From 7758ada9f3872cc9cb4c76c733dbc553562b3d7d Mon Sep 17 00:00:00 2001
3c4af5
From: Kinga Tanska <kinga.tanska@intel.com>
3c4af5
Date: Fri, 29 May 2020 08:31:36 +0200
3c4af5
Subject: [PATCH 082/108] Block overwriting existing links while manual
3c4af5
 assembly
3c4af5
3c4af5
Manual assembly with existing link caused overwriting
3c4af5
this link. Add checking link and block this situation.
3c4af5
3c4af5
Signed-off-by: Kinga Tanska <kinga.tanska@intel.com>
3c4af5
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
3c4af5
---
3c4af5
 Assemble.c | 4 ++++
3c4af5
 1 file changed, 4 insertions(+)
3c4af5
3c4af5
diff --git a/Assemble.c b/Assemble.c
3c4af5
index 3e5d4e6..ed0ddfb 100644
3c4af5
--- a/Assemble.c
3c4af5
+++ b/Assemble.c
3c4af5
@@ -1482,6 +1482,10 @@ try_again:
3c4af5
 				name = content->name;
3c4af5
 			break;
3c4af5
 		}
3c4af5
+		if (mddev && map_by_name(&map, mddev) != NULL) {
3c4af5
+			pr_err("Cannot create device with %s because is in use\n", mddev);
3c4af5
+			goto out;
3c4af5
+		}
3c4af5
 		if (!auto_assem)
3c4af5
 			/* If the array is listed in mdadm.conf or on
3c4af5
 			 * command line, then we trust the name
3c4af5
-- 
3c4af5
2.7.5
3c4af5