* [PATCH v2] md/raid5-ppl: fix use-after-free in ppl_do_flush()
@ 2026-06-22 14:06 Sajal Gupta
0 siblings, 0 replies; only message in thread
From: Sajal Gupta @ 2026-06-22 14:06 UTC (permalink / raw)
To: linux-raid, song
Cc: yukuai3, tomasz.majchrzak, linux-kernel, error27, skhan, me,
linux-kernel-mentees, Sajal Gupta
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: 1532d9e87e8b ("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>
---
Compile tested only.
Changes in v2:
- drop the refcount_t conversion
v1: https://lore.kernel.org/all/20260622080656.22786-1-sajal2005gupta@gmail.com/
drivers/md/raid5-ppl.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/md/raid5-ppl.c b/drivers/md/raid5-ppl.c
index a70cbec12ed0..c3cfdd66d8b0 100644
--- a/drivers/md/raid5-ppl.c
+++ b/drivers/md/raid5-ppl.c
@@ -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;
+ }
}
}
--
2.54.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-06-22 14:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-22 14:06 [PATCH v2] md/raid5-ppl: fix use-after-free in ppl_do_flush() Sajal Gupta
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox