[PATCH] Block overwriting existing links while manual assembly

Subsystems: the rest

STALE2294d

2 messages, 2 authors, 2020-05-27 · open the first message on its own page

[PATCH] Block overwriting existing links while manual assembly

From: Kinga Tanska <hidden>
Date: 2020-05-27 07:14:43

Manual assembly with existing link caused overwriting
this link. Add checking link and block this situation.

Change-Id: I29ef58636e8fd8583bcaef1b28b6cf2edec385ef
Signed-off-by: Kinga Tanska <redacted>
---
 Assemble.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/Assemble.c b/Assemble.c
index 6b5a7c8e..92616251 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
-- 
2.16.4

Re: [PATCH] Block overwriting existing links while manual assembly

From: Jes Sorensen <jes.sorensen@gmail.com>
Date: 2020-05-27 14:05:32

On 5/27/20 3:14 AM, Kinga Tanska wrote:
Manual assembly with existing link caused overwriting
this link. Add checking link and block this situation.

Change-Id: I29ef58636e8fd8583bcaef1b28b6cf2edec385ef
Signed-off-by: Kinga Tanska <redacted>
---
 Assemble.c | 4 ++++
 1 file changed, 4 insertions(+)
Looks fine to me, but what is that non-standard Change-Id: tag you added?

Thanks,
Jes
quoted hunk
diff --git a/Assemble.c b/Assemble.c
index 6b5a7c8e..92616251 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help