Thread (2 messages) 2 messages, 2 authors, 2011-09-07

[PATCH] FIX: Prevent using null list pointer

flat view
STALE5516d

From: Lukasz Dorau <hidden>
Date: 2011-09-01 13:28:36
Subsystem: the rest · Maintainer: Linus Torvalds

When not all attributes are supported (attributes incompatibility)
function container_content_imsm returns NULL pointer.
In this case mdadm should immediately exit with error to prevent
using null "list" pointer.

Signed-off-by: Lukasz Dorau <redacted>
---
 Incremental.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/Incremental.c b/Incremental.c
index 951c2a0..deace7d 100644
--- a/Incremental.c
+++ b/Incremental.c
@@ -1460,6 +1460,11 @@ static int Incremental_container(struct supertype *st, char *devname,
 		trustworthy = FOREIGN;
 
 	list = st->ss->container_content(st, NULL);
+	if (!list) {
+		fprintf(stderr, Name ": Cannot get container content. "
+				"Array cannot be assembled.\n");
+		return 2;
+	}
 	if (map_lock(&map))
 		fprintf(stderr, Name ": failed to get exclusive lock on "
 			"mapfile\n");

---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
z siedziba w Gdansku
ul. Slowackiego 173
80-298 Gdansk

Sad Rejonowy Gdansk Polnoc w Gdansku, 
VII Wydzial Gospodarczy Krajowego Rejestru Sadowego, 
numer KRS 101882

NIP 957-07-52-316
Kapital zakladowy 200.000 zl

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help