Thread (1 message) 1 message, 1 author, 2012-02-16

Re: mdadm segfault at assemble

From: NeilBrown <hidden>
Date: 2012-02-16 03:12:25
Subsystem: the rest · Maintainer: Linus Torvalds

On Wed, 15 Feb 2012 08:54:32 +0100 Arkadiusz Miśkiewicz [off-list ref]
wrote:
Hi,

mapfile.c:434 

struct mddev_ident *match = conf_match(st, info, NULL, 0, NULL);

so devname is NULL and that's passed down to fnmatch in match_oneof causing 
segfault.

Looked at git and it seems to be the same as in mine 3.2.3 version.

Starting program: /sbin/mdadm --assemble --scan --auto=yes

Program received signal SIGSEGV, Segmentation fault.
0xb7ef9f15 in fnmatch () from /lib/libc.so.6
(gdb) bt
#0  0xb7ef9f15 in fnmatch () from /lib/libc.so.6
#1  0x08051caf in match_oneof (devices=0x80dea79 ",/dev/sdb3", devname=0x0) at 
config.c:958
#2  0x08052051 in conf_match (st=0x80def50, info=0x80e11b8, devname=0x0, 
verbose=0, rvp=0x0) at config.c:1049
#3  0x080a8e0c in RebuildMap () at mapfile.c:434
#4  0x080a865b in map_read (melp=0xbffff8a4) at mapfile.c:201
#5  0x080a8526 in map_lock (melp=0xbffff8a4) at mapfile.c:145
#6  0x0804e0f6 in main (argc=4, argv=0xbffffc54) at mdadm.c:1320
Thanks for the report.

This should fix it.

NeilBrown


commit 9f1b0f0f1ed0dd4752be65348a24971335cd50e8
Author: NeilBrown [off-list ref]
Date:   Thu Feb 16 14:11:57 2012 +1100

    config: conf_match should ignore devname when not set.
    
    mapfile:RebuildMap calls conf_match with no devname, so we must be
    careful not to use it.
    
    Reported-by: Arkadiusz Miśkiewicz [off-list ref]
    Signed-off-by: NeilBrown [off-list ref]
diff --git a/config.c b/config.c
index 6027b2f..d8f48e1 100644
--- a/config.c
+++ b/config.c
@@ -1045,7 +1045,7 @@ struct mddev_ident *conf_match(struct supertype *st,
 					array_list->devname);
 			continue;
 		}
-		if (array_list->devices &&
+		if (array_list->devices && devname &&
 		    !match_oneof(array_list->devices, devname)) {
 			if (verbose >= 2 && array_list->devname)
 				fprintf(stderr, Name

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help