]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
FIX: mdadm throws coredump on exit in error case
authorAdam Kwolek <adam.kwolek@intel.com>
Mon, 17 Jan 2011 01:38:13 +0000 (12:38 +1100)
committerNeilBrown <neilb@suse.de>
Mon, 17 Jan 2011 01:38:13 +0000 (12:38 +1100)
When mdadm falls in "reduce size" error on takeovered array it jumps
to release and tries execute backward takeover. This time sra pointer
is not initialized and coredump is generated.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Grow.c

diff --git a/Grow.c b/Grow.c
index 19ad1805e4ad9841e3b979a55db4615c098fd89d..447e87e5940c2d68554b68d1f1b9973cdee9ac51 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -1599,7 +1599,7 @@ static int reshape_array(char *container, int fd, char *devname,
        unsigned long cache;
        unsigned long long array_size;
        int done;
-       struct mdinfo *sra;
+       struct mdinfo *sra = NULL;
 
        msg = analyse_change(info, &reshape);
        if (msg) {
@@ -1777,7 +1777,6 @@ started:
        sra = sysfs_read(fd, 0,
                         GET_COMPONENT|GET_DEVS|GET_OFFSET|GET_STATE|GET_CHUNK|
                         GET_CACHE);
-
        if (!sra) {
                fprintf(stderr, Name ": %s: Cannot get array details from sysfs\n",
                        devname);