mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
md/raid5-ppl: fix use-after-free in ppl_do_flush()
The loop in ppl_do_flush() continues iterating after calling
ppl_io_unit_finished(), touching io->pending_flushes and leading to a
use-after-free.
Add a break statement to stop the loop once io is freed.
Fixes: 1532d9e87e ("raid5-ppl: PPL support for disks with write-back cache enabled")
Reported-by: Dan Carpenter <error27@gmail.com>
Closes: https://lore.kernel.org/all/ajJF2wKYWRk4GGCK@stanley.mountain/
Signed-off-by: Sajal Gupta <sajal2005gupta@gmail.com>
Reviewed-by: Yu Kuai <yukuai@fygo.io>
Link: https://patch.msgid.link/20260622142146.56637-1-sajal2005gupta@gmail.com
Signed-off-by: Yu Kuai <yukuai@fygo.io>
This commit is contained in:
parent
f565925810
commit
371f7a1b39
|
|
@ -643,8 +643,10 @@ static void ppl_do_flush(struct ppl_io_unit *io)
|
|||
log->disk_flush_bitmap = 0;
|
||||
|
||||
for (i = flushed_disks ; i < raid_disks; i++) {
|
||||
if (atomic_dec_and_test(&io->pending_flushes))
|
||||
if (atomic_dec_and_test(&io->pending_flushes)) {
|
||||
ppl_io_unit_finished(io);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user