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 <[email protected]>
Signed-off-by:	Alexander Motin <[email protected]>
Sponsored by:	iXsystems, Inc.
Closes #16868
This commit is contained in:
Alexander Motin authored and GitHub committed 2024-12-14 14:02:11 -08:00
1 parent 586304ac44
commit ff6266ee9b
1 file changed
+2 -2
+2 -2
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]);
}