[Devel] [PATCH hci-8.1 v7 5/6] ovl: Fix leaking fd references in ovl_copyfile
Vladimir Riabchun
vladimir.riabchun at virtuozzo.com
Mon Nov 16 20:18:55 MSK 2026
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 at 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
More information about the Devel
mailing list