[Devel] [PATCH hci-8.2 2/2] dm-ploop: don't put a NULL bat page in ploop_free_piwb()

Vasileios Almpanis vasileios.almpanis at virtuozzo.com
Fri Nov 27 15:31:05 MSK 2026


ploop_prepare_bat_update() allocates the bat page and the pio with
GFP_ATOMIC. If one of the allocations fails, it calls ploop_free_piwb(),
which calls put_page() on the bat page even if it is NULL. Under memory
pressure this oopses with bat_lock held.

Put the bat page only if it was allocated.

https://virtuozzo.atlassian.net/browse/VSTOR-157566

Fixes: 90bb85536272 ("dm-ploop: Add ploop target driver")
Feature: dm-ploop: ploop target driver
Reported-by: Artem Bulgakov <artem.bulgakov at virtuozzo.com>
Signed-off-by: Vasileios Almpanis <vasileios.almpanis at virtuozzo.com>
---
 drivers/md/dm-ploop-map.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index c62b414862b1..866def8f5304 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -918,7 +918,8 @@ static void ploop_advance_local_after_bat_wb(struct ploop *ploop,
 static void ploop_free_piwb(struct ploop_index_wb *piwb)
 {
 	ploop_free_pio(piwb->ploop, piwb->pio);
-	put_page(piwb->bat_page);
+	if (piwb->bat_page)
+		put_page(piwb->bat_page);
 	kfree(piwb);
 }
 

-- 
2.43.0



More information about the Devel mailing list