!69 [sync] PR-66: fix file leak in high level API
From: @openeuler-sync-bot Reviewed-by: @swf504 Signed-off-by: @swf504
This commit is contained in:
commit
c8b8dffad1
43
0008-Fix-file-leak-in-high-level-API.patch
Normal file
43
0008-Fix-file-leak-in-high-level-API.patch
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
From f1e373d9af5b50a0f9a279eb8d8d3a327c9d5ef3 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 ff5d91b..5099601 100644
|
||||||
|
--- 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: 7
|
Release: 8
|
||||||
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
|
||||||
@ -16,6 +16,7 @@ Patch4: 0004-Use-destroy_req-instead-of-free-to-destroy-fuse_req.patch
|
|||||||
Patch5: 0005-Fix-use-after-free-warning.patch
|
Patch5: 0005-Fix-use-after-free-warning.patch
|
||||||
Patch6: 0006-Disable-leak-suppression-773.patch
|
Patch6: 0006-Disable-leak-suppression-773.patch
|
||||||
Patch7: 0007-Fix-memory-leak-in-high-level-API-781.patch
|
Patch7: 0007-Fix-memory-leak-in-high-level-API-781.patch
|
||||||
|
Patch8: 0008-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
|
||||||
@ -106,6 +107,9 @@ install -p -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}
|
|||||||
%{_mandir}/man8/*
|
%{_mandir}/man8/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sat Mar 30 2024 yangyun <yangyun50@huawei.com> -3.10.5-8
|
||||||
|
- fix file leak in high level API
|
||||||
|
|
||||||
* Thu Feb 8 2024 yangyun <yangyun50@huawei.com> -3.10.5-7
|
* Thu Feb 8 2024 yangyun <yangyun50@huawei.com> -3.10.5-7
|
||||||
- fix memory leak in high level API
|
- fix memory leak in high level API
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user