(Online Capacity Expansion for IMSM) For external metadata case free() operation causes core. The cause of this is too small memory allocation due to empty array.spare_disks number for external metadata used for required memory allocation size computing. To resolve this situation requested number of disks is used as allocated buffer size for external metadata. Signed-off-by: Adam Kwolek <adam.kwolek@xxxxxxxxx> --- Grow.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Grow.c b/Grow.c index 29a6394..ab83e31 100644 --- a/Grow.c +++ b/Grow.c @@ -1103,7 +1103,10 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file, rv = 1; break; } - nrdisks = array.nr_disks + sra->array.spare_disks; + if ((st == NULL) || (st->ss->external == 0)) + nrdisks = array.nr_disks + sra->array.spare_disks; + else + nrdisks = (raid_disks > array.nr_disks) ? raid_disks : +array.nr_disks; /* Now we need to open all these devices so we can read/write. */ fdlist = malloc((1+nrdisks) * sizeof(int)); ��.n��������+%������w��{.n�����{����w��ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f