passthrough_ll: fix fd leaks in lo_destroy() (#929)
authorlegezywzh <94814730+legezywzh@users.noreply.github.com>
Sat, 20 Apr 2024 11:40:16 +0000 (19:40 +0800)
committerGitHub <noreply@github.com>
Sat, 20 Apr 2024 11:40:16 +0000 (13:40 +0200)
By virtio-fs and libfuse fuse_custom_io, passthrough_ll could be
a virtio filesystem device backend, this bug was found when doing
mount, fsstress and umount repeatedly.

Signed-off-by: Xiaoguang Wang <lege.wang@jaguarmicro.com>
Co-authored-by: Xiaoguang Wang <lege.wang@jaguarmicro.com>
example/passthrough_ll.c

index 4a597f2d3fa8df076b5e37a5f26c4bb4779f8ee2..9d38a7f2faec625091dcd93c9863a82265b1c346 100644 (file)
@@ -190,6 +190,7 @@ static void lo_destroy(void *userdata)
        while (lo->root.next != &lo->root) {
                struct lo_inode* next = lo->root.next;
                lo->root.next = next->next;
+               close(next->fd);
                free(next);
        }
 }