]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Grow.c
mdadm/Grow: Fix use after close bug by closing after fork
[thirdparty/mdadm.git] / Grow.c
diff --git a/Grow.c b/Grow.c
index 8c520d428ed24a6d3b46fa645dd2f7771445ddc7..97f22c75635c9157180125af8746e530acb9d629 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -3514,7 +3514,6 @@ started:
                        return 0;
                }
 
-       close(fd);
        /* Now we just need to kick off the reshape and watch, while
         * handling backups of the data...
         * This is all done by a forked background process.
@@ -3535,6 +3534,9 @@ started:
                break;
        }
 
+       /* Close unused file descriptor in the forked process */
+       close_fd(&fd);
+
        /* If another array on the same devices is busy, the
         * reshape will wait for them.  This would mean that
         * the first section that we suspend will stay suspended