Fix use-afer-free regression in RAIDZ expansion

We should not dereference rra after the last zio_nowait() is called.
It seems very unlikely, but ASAN in ztest managed to catch it.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by:	Alexander Motin <mav@FreeBSD.org>
Sponsored by:	iXsystems, Inc.
Closes #16868
This commit is contained in:
Alexander Motin 2024-12-14 17:02:11 -05:00 committed by GitHub
parent 586304ac44
commit ff6266ee9b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3914,8 +3914,8 @@ raidz_reflow_read_done(zio_t *zio)
if (atomic_dec_32_nv(&rra->rra_tbd) > 0)
return;
rra->rra_tbd = rra->rra_writes;
for (uint64_t i = 0; i < rra->rra_writes; i++)
uint32_t writes = rra->rra_tbd = rra->rra_writes;
for (uint64_t i = 0; i < writes; i++)
zio_nowait(rra->rra_zio[i]);
}