All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
* [Devel] [PATCH hci-8.1 1/2] fs/fuse/kio: fix page cache leak in cs accel submit
@ 2026-12-01 15:18 Alexey Kuznetsov
  0 siblings, 0 replies; only message in thread
From: Alexey Kuznetsov @ 2026-12-01 15:18 UTC (permalink / raw)
  To: devel, khorenko, kui.liu, azaitsev

crc pages could leak in case we reject AIO because of wrong
kind of iov iterator (impossible, but still), or when AIO
submit fails or returns short read, which really happens.

Just release them explicitly.

Fixes: 5acc64b761cd ("fuse: implement fast access to encrypted CSes")
https://virtuozzo.atlassian.net/browse/VSTOR-158112

Signed-off-by: Alexey Kuznetsov <kuznet@virtuozzo.com>

Feature: vStorage
---
 fs/fuse/kio/pcs/pcs_cs_accel.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/fs/fuse/kio/pcs/pcs_cs_accel.c b/fs/fuse/kio/pcs/pcs_cs_accel.c
index c8bdc606c63b..04e86ab8e533 100644
--- a/fs/fuse/kio/pcs/pcs_cs_accel.c
+++ b/fs/fuse/kio/pcs/pcs_cs_accel.c
@@ -574,6 +574,18 @@ static inline int quick_crc_fetch(struct pcs_int_request * ireq, struct file * c
 	return 0;
 }
 
+static void csa_put_crc_pages(struct pcs_aio_req *areq)
+{
+	if (areq->crc_page[0]) {
+		put_page(areq->crc_page[0]);
+		areq->crc_page[0] = NULL;
+	}
+	if (areq->crc_page[1]) {
+		put_page(areq->crc_page[1]);
+		areq->crc_page[1] = NULL;
+	}
+}
+
 static void csa_crc_work(struct work_struct *w)
 {
 	struct pcs_aio_req * areq = container_of(w, struct pcs_aio_req, work);
@@ -681,6 +693,7 @@ static inline int csa_submit(struct file * file, struct file *cfile, int do_csum
 	ar->get_iter(ar->datasource, ireq->iochunk.dio_offset, it, READ);
 	if (!iov_iter_is_bvec(it)) {
 		FUSE_KTRACE(ireq->cc->fc, "Not a bvec, falling back");
+		csa_put_crc_pages(areq);
 		return -EINVAL;
 	}
 
@@ -707,6 +720,7 @@ static inline int csa_submit(struct file * file, struct file *cfile, int do_csum
 				    ireq, (unsigned long long)ireq->iochunk.chunk,
 				    (unsigned)ireq->iochunk.offset,
 				    (unsigned)size);
+			csa_put_crc_pages(areq);
 			return ret >= 0 ? -EIO : ret;
 		}
 
-- 
2.47.1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-01 15:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-01 15:18 [Devel] [PATCH hci-8.1 1/2] fs/fuse/kio: fix page cache leak in cs accel submit Alexey Kuznetsov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.