qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 4/5] virtiofsd: fix inode nlookup leaks


From: Stefan Hajnoczi
Subject: [Qemu-devel] [PATCH 4/5] virtiofsd: fix inode nlookup leaks
Date: Wed, 31 Jul 2019 17:10:05 +0100

utimensat_empty() and linkat_empty_nofollow() must unref the parent
directory inode that was obtained from lo_parent_and_name().

Signed-off-by: Stefan Hajnoczi <address@hidden>
---
 contrib/virtiofsd/passthrough_ll.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/contrib/virtiofsd/passthrough_ll.c 
b/contrib/virtiofsd/passthrough_ll.c
index 135123366a..125e9d9f96 100644
--- a/contrib/virtiofsd/passthrough_ll.c
+++ b/contrib/virtiofsd/passthrough_ll.c
@@ -567,8 +567,10 @@ static int utimensat_empty(struct lo_data *lo, struct 
lo_inode *inode,
 
 fallback:
        res = lo_parent_and_name(lo, inode, path, &parent);
-       if (res != -1)
+       if (res != -1) {
                res = utimensat(parent->fd, path, tv, AT_SYMLINK_NOFOLLOW);
+               unref_inode(lo, parent, 1);
+       }
 
        return res;
 }
@@ -1024,8 +1026,10 @@ static int linkat_empty_nofollow(struct lo_data *lo, 
struct lo_inode *inode,
 
 fallback:
        res = lo_parent_and_name(lo, inode, path, &parent);
-       if (res != -1)
+       if (res != -1) {
                res = linkat(parent->fd, path, dfd, name, 0);
+               unref_inode(lo, parent, 1);
+       }
 
        return res;
 }
-- 
2.21.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]