Re: [PATCH V3 3/3] Assemble: cleanup the failure path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 08/17/2018 08:08 PM, Tkaczyk, Mariusz wrote:
Hi,
After this patch I found "double free or corruption".

Scenario:

mdadm -CR /dev/md/vol -l0 -e 1.2 -n2 /dev/sd[b-c] --assume-clean
mdadm -Ss
mdadm -A /dev/md127 /dev/sd[b-c] --update metadata



*** Error in `mdadm': double free or corruption (!prev):


Could you try below changes?

diff --git a/Assemble.c b/Assemble.c
index 23892a3720ac..9d0bc1000f96 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -1536,6 +1536,11 @@ try_again:
                              &most_recent, &bestcnt, &best, inargv);
        if (devcnt < 0) {
                mdfd = -3;
+               /*
+                * devices is already freed in load_devices, so set devices
+                * to NULL to avoid double free devices.
+                */
+               devices = NULL;
                goto out;
        }

Thanks,
Guoqing



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux