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 <[email protected]>
---
 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
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to