Skip to content

Commit

Permalink
Fix use-afer-free regression in RAIDZ expansion
Browse files Browse the repository at this point in the history
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
  • Loading branch information
amotin authored Dec 14, 2024
1 parent 586304a commit ff6266e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions module/zfs/vdev_raidz.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}

Expand Down

0 comments on commit ff6266e

Please sign in to comment.