From: Vladimir Riabchun <vladimir.riabchun@virtuozzo.com>
To: vasileios.almpanis@virtuozzo.com, ptikhomirov@virtuozzo.com,
Konstantin Khorenko <khorenko@virtuozzo.com>
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.1 v8 5/6] ovl: Fix leaking fd references in ovl_copyfile
Date: Mon, 16 Nov 2026 20:20:43 +0100 [thread overview]
Message-ID: <20261116-ovl-use-orig-ve-v8-5-dfe427bfd902@virtuozzo.com> (raw)
In-Reply-To: <20261116-ovl-use-orig-ve-v8-0-dfe427bfd902@virtuozzo.com>
We lack of ovl_real_file, added in d66907b[1], which changed
logic so that the code needs no fdput anymore. We still need it.
Imported commit a1e0eb8[2] didn't bother with fdput cleanup,
because it relied on d66907b existence. We need to perform
a cleanup when rw_verify_area fails and put real_in/real_out fds.
[1]: https://github.com/torvalds/linux/commit/d66907b51ba0
[2]: https://github.com/torvalds/linux/commit/a1e0eb8f55cf
https://virtuozzo.atlassian.net/browse/VSTOR-142405
Fixes: d5a10d38e534 ("rh10: import RHEL10 kernel-6.12.0-211.75.1.el10")
Signed-off-by: Vladimir Riabchun <vladimir.riabchun@virtuozzo.com>
---
fs/overlayfs/file.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c
index 2531433f47bf..7588449809ec 100644
--- a/fs/overlayfs/file.c
+++ b/fs/overlayfs/file.c
@@ -524,7 +524,7 @@ static loff_t ovl_copyfile(struct file *file_in, loff_t pos_in,
ret = rw_verify_area(READ, fd_file(real_in), &pos_in, len);
revert_creds(old_cred);
if (unlikely(ret))
- goto out_unlock;
+ goto out_put_real;
}
old_cred = ovl_override_creds(inode_out->i_sb);
@@ -550,6 +550,7 @@ static loff_t ovl_copyfile(struct file *file_in, loff_t pos_in,
/* Update size */
ovl_file_modified(file_out);
+out_put_real:
fdput(real_in);
fdput(real_out);
--
2.52.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next prev parent reply other threads:[~2026-11-16 19:22 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 19:20 [Devel] [PATCH hci-8.1 v8 0/6] Fix kernel crash in overlayfs Vladimir Riabchun
2026-11-16 19:20 ` [Devel] [PATCH hci-8.1 v8 1/6] ve: Remove STOPPED state Vladimir Riabchun
2026-11-16 19:25 ` no-reply
2026-11-16 19:20 ` [Devel] [PATCH hci-8.1 v8 2/6] ve: Introduce override_ve/revert_ve helpers Vladimir Riabchun
2026-11-16 19:27 ` no-reply
2026-11-16 20:05 ` Vladimir Riabchun
2026-11-16 19:20 ` [Devel] [PATCH hci-8.1 v8 3/6] ve: Defer ve creds drop until ve is completely destroyed Vladimir Riabchun
2026-11-16 19:27 ` no-reply
2026-11-16 19:20 ` [Devel] [PATCH hci-8.1 v8 4/6] ovl: Keep creator VE in overlayfs superblock Vladimir Riabchun
2026-11-16 19:28 ` no-reply
2026-11-17 14:49 ` Konstantin Khorenko
2026-11-16 19:20 ` Vladimir Riabchun [this message]
2026-11-16 19:28 ` [Devel] [PATCH hci-8.1 v8 5/6] ovl: Fix leaking fd references in ovl_copyfile no-reply
2026-11-16 20:03 ` Vladimir Riabchun
2026-11-16 19:20 ` [Devel] [PATCH hci-8.1 v8 6/6] ve/overlayfs: Override VE together with creds Vladimir Riabchun
2026-11-16 19:36 ` no-reply
2026-11-16 20:03 ` Vladimir Riabchun
2026-11-17 14:49 ` [Devel] [PATCH hci-8.1 v8 0/6] Fix kernel crash in overlayfs Konstantin Khorenko
2026-11-17 14:49 ` Konstantin Khorenko
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=20261116-ovl-use-orig-ve-v8-5-dfe427bfd902@virtuozzo.com \
--to=vladimir.riabchun@virtuozzo.com \
--cc=devel@openvz.org \
--cc=khorenko@virtuozzo.com \
--cc=ptikhomirov@virtuozzo.com \
--cc=vasileios.almpanis@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