[Devel] [PATCH RH7] ploop: Fix leak of discard kreq

Kirill Tkhai ktkhai at virtuozzo.com
Mon May 17 16:40:08 MSK 2021


In case of kaio is async, kreq is freed from endio.
In case of sync kreq, we should free it ourselves.

https://jira.sw.ru/browse/PSBM-129412
Fixes: commit d2709bb9ac22 "ploop: Enable 1M holes with zeroing indexes for io_kaio"
Reported-by: Alexey Bilan <alexey.bilan at virtuozzo.com>
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/block/ploop/io_kaio.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/block/ploop/io_kaio.c b/drivers/block/ploop/io_kaio.c
index 44df242d8128..bc245ea3a5b3 100644
--- a/drivers/block/ploop/io_kaio.c
+++ b/drivers/block/ploop/io_kaio.c
@@ -191,6 +191,7 @@ static int kaio_kernel_submit(struct file *file, struct kaio_req *kreq,
 				    pos, count);
 			if (err == 0) {
 				kaio_complete_io_request(kreq->preq);
+				kfree(kreq);
 				/* Otherwise, caller decrements counter */
 			}
 			return err;




More information about the Devel mailing list