From: Alexey Kuznetsov <kuznet@virtuozzo.com>
To: devel@openvz.org, khorenko@virtuozzo.com, kui.liu@virtuozzo.com,
azaitsev@virtuozzo.com
Subject: [Devel] [PATCH hci-8.1 1/2] fs/fuse/kio: fix page cache leak in cs accel submit
Date: Tue, 1 Dec 2026 23:18:07 +0800 [thread overview]
Message-ID: <aw7lL0UgvhKv6mCL@mops2> (raw)
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
reply other threads:[~2026-12-01 15:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aw7lL0UgvhKv6mCL@mops2 \
--to=kuznet@virtuozzo.com \
--cc=azaitsev@virtuozzo.com \
--cc=devel@openvz.org \
--cc=khorenko@virtuozzo.com \
--cc=kui.liu@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox