All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
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 v7 5/6] ovl: Fix leaking fd references in ovl_copyfile
Date: Mon, 16 Nov 2026 18:18:55 +0100	[thread overview]
Message-ID: <20261116-ovl-use-orig-ve-v7-5-37daa56081ed@virtuozzo.com> (raw)
In-Reply-To: <20261116-ovl-use-orig-ve-v7-0-37daa56081ed@virtuozzo.com>

Latest rebase onto kernel-6.12.0-211.75.1.el10 introduced a leak.
We lack of ovl_real_file, added in d66907b[1], which changed
logic so we need no fdput anymore.

Imported commit a1e0eb8[2] didn't bother with fdput cleanup,
because it relied on d66907b existence. We still need to
perform cleanup and put fds.

[1]: https://github.com/torvalds/linux/commit/d66907b51ba0
[2]: https://github.com/torvalds/linux/commit/a1e0eb8f55cf

https://virtuozzo.atlassian.net/browse/VSTOR-142405
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

  parent reply	other threads:[~2026-11-16 17:20 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 17:18 [Devel] [PATCH hci-8.1 v7 0/6] Fix kernel crash in overlayfs Vladimir Riabchun
2026-11-16 17:18 ` [Devel] [PATCH hci-8.1 v7 1/6] ve: Remove STOPPED state Vladimir Riabchun
2026-11-16 17:23   ` no-reply
2026-11-16 17:35     ` Vladimir Riabchun
2026-11-16 17:18 ` [Devel] [PATCH hci-8.1 v7 2/6] ve: Introduce override_ve/revert_ve helpers Vladimir Riabchun
2026-11-16 17:25   ` no-reply
2026-11-16 17:18 ` [Devel] [PATCH hci-8.1 v7 3/6] ve: Defer ve creds drop until ve is completely destroyed Vladimir Riabchun
2026-11-16 17:26   ` no-reply
2026-11-16 17:18 ` [Devel] [PATCH hci-8.1 v7 4/6] ovl: Keep creator VE in overlayfs superblock Vladimir Riabchun
2026-11-16 17:27   ` no-reply
2026-11-16 17:18 ` Vladimir Riabchun [this message]
2026-11-16 17:27   ` [Devel] [PATCH hci-8.1 v7 5/6] ovl: Fix leaking fd references in ovl_copyfile no-reply
2026-11-16 17:18 ` [Devel] [PATCH hci-8.1 v7 6/6] ve/overlayfs: Override VE together with creds Vladimir Riabchun
2026-11-16 17:32   ` no-reply
2026-11-16 17:45     ` Vladimir Riabchun
2026-11-16 17:43 ` [Devel] [PATCH hci-8.1 v7 0/6] Fix kernel crash in overlayfs Konstantin Khorenko
2026-11-16 20:22   ` Vladimir Riabchun

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-v7-5-37daa56081ed@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 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.