[Devel] [PATCH 1/1] Drivers: md: ploop - Do not leak a page on allocation failure
Alexander Atanasov
alexander.atanasov at virtuozzo.com
Wed Jul 20 14:05:28 MSK 2022
Fix off-by-one error - tries to free the failed allocation and
it leaks the first successful
Signed-off-by: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
---
drivers/md/dm-ploop-cmd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c
index 429a03cce392..e4ea738828bc 100644
--- a/drivers/md/dm-ploop-cmd.c
+++ b/drivers/md/dm-ploop-cmd.c
@@ -489,7 +489,7 @@ struct pio *alloc_pio_with_pages(struct ploop *ploop)
return pio;
err:
- while (i-- > 0)
+ while (--i >= 0)
put_page(pio->bi_io_vec[i].bv_page);
kfree(pio);
return NULL;
--
2.31.1
More information about the Devel
mailing list