fix file leak in high level api
(cherry picked from commit a14252edd74287f10aaf3682bfe95f56ffde64eb)
This commit is contained in:
parent
bf5fa17311
commit
e64ec3dfe8
43
0010-Fix-file-leak-in-high-level-API.patch
Normal file
43
0010-Fix-file-leak-in-high-level-API.patch
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
From 4b6148831a9e36cb2ca3ba4920cf2def6fe8a3c0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peri <peri@srdi.org>
|
||||||
|
Date: Thu, 11 May 2023 02:38:46 +0100
|
||||||
|
Subject: [PATCH] Fix file leak in high level API
|
||||||
|
|
||||||
|
Added a secondary check in fuse_lib_unlink() after hide_node()
|
||||||
|
to check again under a lock if the (now hidden) file is still open.
|
||||||
|
If not then delete it.
|
||||||
|
|
||||||
|
This should synchronise fuse_lib_unlink() with fuse_lib_release(),
|
||||||
|
when nullpath_ok is set.
|
||||||
|
---
|
||||||
|
lib/fuse.c | 14 ++++++++++++++
|
||||||
|
1 file changed, 14 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/lib/fuse.c b/lib/fuse.c
|
||||||
|
index 1c0627e..44e4857 100755
|
||||||
|
--- a/lib/fuse.c
|
||||||
|
+++ b/lib/fuse.c
|
||||||
|
@@ -3014,6 +3014,20 @@ static void fuse_lib_unlink(fuse_req_t req, fuse_ino_t parent,
|
||||||
|
fuse_prepare_interrupt(f, req, &d);
|
||||||
|
if (!f->conf.hard_remove && is_open(f, parent, name)) {
|
||||||
|
err = hide_node(f, path, parent, name);
|
||||||
|
+ if (!err) {
|
||||||
|
+ /* we have hidden the node so now check again under a lock in case it is not used any more */
|
||||||
|
+ if (!is_open(f, parent, wnode->name)) {
|
||||||
|
+ char *unlinkpath;
|
||||||
|
+
|
||||||
|
+ /* get the hidden file path, to unlink it */
|
||||||
|
+ if (try_get_path(f, wnode->nodeid, NULL, &unlinkpath, NULL, false) == 0) {
|
||||||
|
+ err = fuse_fs_unlink(f->fs, unlinkpath);
|
||||||
|
+ if (!err)
|
||||||
|
+ remove_node(f, parent, wnode->name);
|
||||||
|
+ free(unlinkpath);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
} else {
|
||||||
|
err = fuse_fs_unlink(f->fs, path);
|
||||||
|
if (!err)
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Name: fuse3
|
Name: fuse3
|
||||||
Version: %{fuse3ver}
|
Version: %{fuse3ver}
|
||||||
Release: 12
|
Release: 13
|
||||||
Summary: User space File System of fuse3
|
Summary: User space File System of fuse3
|
||||||
License: GPL+ and LGPLv2+
|
License: GPL+ and LGPLv2+
|
||||||
URL: http://fuse.sf.net
|
URL: http://fuse.sf.net
|
||||||
@ -18,6 +18,7 @@ Patch6: 0006-Fix-fd-leak-with-clone_fd.patch
|
|||||||
Patch7: 0007-Fix-use-after-free-warning.patch
|
Patch7: 0007-Fix-use-after-free-warning.patch
|
||||||
Patch8: 0008-Disable-leak-suppression-773.patch
|
Patch8: 0008-Disable-leak-suppression-773.patch
|
||||||
Patch9: 0009-Fix-memory-leak-in-high-level-API-781.patch
|
Patch9: 0009-Fix-memory-leak-in-high-level-API-781.patch
|
||||||
|
Patch10: 0010-Fix-file-leak-in-high-level-API.patch
|
||||||
|
|
||||||
BuildRequires: libselinux-devel, pkgconfig, systemd-udev, meson, fdupes
|
BuildRequires: libselinux-devel, pkgconfig, systemd-udev, meson, fdupes
|
||||||
BuildRequires: autoconf, automake, libtool, gettext-devel, ninja-build
|
BuildRequires: autoconf, automake, libtool, gettext-devel, ninja-build
|
||||||
@ -108,6 +109,9 @@ install -p -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}
|
|||||||
%{_mandir}/man8/*
|
%{_mandir}/man8/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sat Mar 30 2024 yangyun <yangyun50@huawei.com> -3.9.2-13
|
||||||
|
- fix file leak in high level api
|
||||||
|
|
||||||
* Tue Feb 8 2024 yangyun <yangyun50@huawei.com> -3.9.2-12
|
* Tue Feb 8 2024 yangyun <yangyun50@huawei.com> -3.9.2-12
|
||||||
- fix memory leak in high level api
|
- fix memory leak in high level api
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user