conf: ensure that the idmap pointer itself is freed
see https://github.com/lxc/lxc/pull/3504 Signed-off-by: WangFengTu <wangfengtu@huawei.com>
This commit is contained in:
parent
c1ffca57a0
commit
10f4794cfe
@ -0,0 +1,71 @@
|
|||||||
|
From 8156691b97ac48763cf42c03aa3b92cfa37f1488 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Christian Brauner <christian.brauner@ubuntu.com>
|
||||||
|
Date: Tue, 4 Aug 2020 00:05:05 +0200
|
||||||
|
Subject: [PATCH] conf: ensure that the idmap pointer itself is freed
|
||||||
|
|
||||||
|
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
|
||||||
|
|
||||||
|
(cherry-picked from https://github.com/lxc/lxc/pull/3504)
|
||||||
|
Conflicts:
|
||||||
|
src/lxc/conf.c
|
||||||
|
|
||||||
|
Signed-off-by: WangFengTu <wangfengtu@huawei.com>
|
||||||
|
---
|
||||||
|
src/lxc/conf.c | 20 +++++++++++++-------
|
||||||
|
1 file changed, 13 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/lxc/conf.c b/src/lxc/conf.c
|
||||||
|
index 2a6e27aa4..7464e4a15 100644
|
||||||
|
--- a/src/lxc/conf.c
|
||||||
|
+++ b/src/lxc/conf.c
|
||||||
|
@@ -5362,7 +5362,15 @@ static int lxc_free_idmap(struct lxc_list *id_map)
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
-define_cleanup_function(struct lxc_list *, lxc_free_idmap);
|
||||||
|
+
|
||||||
|
+static int __lxc_free_idmap(struct lxc_list *id_map)
|
||||||
|
+{
|
||||||
|
+ lxc_free_idmap(id_map);
|
||||||
|
+ free(id_map);
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+define_cleanup_function(struct lxc_list *, __lxc_free_idmap);
|
||||||
|
|
||||||
|
int lxc_clear_idmaps(struct lxc_conf *c)
|
||||||
|
{
|
||||||
|
@@ -5939,7 +5947,7 @@ static struct lxc_list *get_minimal_idmap(const struct lxc_conf *conf,
|
||||||
|
int userns_exec_1(const struct lxc_conf *conf, int (*fn)(void *), void *data,
|
||||||
|
const char *fn_name)
|
||||||
|
{
|
||||||
|
- call_cleaner(lxc_free_idmap) struct lxc_list *idmap = NULL;
|
||||||
|
+ call_cleaner(__lxc_free_idmap) struct lxc_list *idmap = NULL;
|
||||||
|
int ret = -1, status = -1;
|
||||||
|
char c = '1';
|
||||||
|
pid_t pid;
|
||||||
|
@@ -6015,7 +6023,7 @@ int userns_exec_minimal(const struct lxc_conf *conf,
|
||||||
|
int (*fn_parent)(void *), void *fn_parent_data,
|
||||||
|
int (*fn_child)(void *), void *fn_child_data)
|
||||||
|
{
|
||||||
|
- call_cleaner(lxc_free_idmap) struct lxc_list *idmap = NULL;
|
||||||
|
+ call_cleaner(__lxc_free_idmap) struct lxc_list *idmap = NULL;
|
||||||
|
uid_t resuid = LXC_INVALID_UID;
|
||||||
|
gid_t resgid = LXC_INVALID_GID;
|
||||||
|
char c = '1';
|
||||||
|
@@ -6306,10 +6314,8 @@ on_error:
|
||||||
|
if (pid > 0)
|
||||||
|
ret = wait_for_pid(pid);
|
||||||
|
|
||||||
|
- if (idmap) {
|
||||||
|
- lxc_free_idmap(idmap);
|
||||||
|
- free(idmap);
|
||||||
|
- }
|
||||||
|
+ if (idmap)
|
||||||
|
+ __lxc_free_idmap(idmap);
|
||||||
|
|
||||||
|
if (host_uid_map && (host_uid_map != container_root_uid))
|
||||||
|
free(host_uid_map);
|
||||||
|
--
|
||||||
|
2.25.1
|
||||||
|
|
||||||
9
lxc.spec
9
lxc.spec
@ -1,4 +1,4 @@
|
|||||||
%global _release 2021102101
|
%global _release 2021111901
|
||||||
|
|
||||||
Name: lxc
|
Name: lxc
|
||||||
Version: 4.0.3
|
Version: 4.0.3
|
||||||
@ -40,6 +40,7 @@ Patch0029: 0029-just-use-origin-loop-if-do-not-have-io.patch
|
|||||||
Patch0030: 0030-conf-fix-a-memory-leak.patch
|
Patch0030: 0030-conf-fix-a-memory-leak.patch
|
||||||
Patch0031: 0031-fix-lsm_se_mount_context-memory-leak.patch
|
Patch0031: 0031-fix-lsm_se_mount_context-memory-leak.patch
|
||||||
Patch0032: 0032-disable-lxc_keep-with-oci-image.patch
|
Patch0032: 0032-disable-lxc_keep-with-oci-image.patch
|
||||||
|
Patch0033: 0033-conf-ensure-that-the-idmap-pointer-itself-is-freed.patch
|
||||||
|
|
||||||
BuildRequires: systemd-units git libtool graphviz docbook2X doxygen chrpath
|
BuildRequires: systemd-units git libtool graphviz docbook2X doxygen chrpath
|
||||||
BuildRequires: pkgconfig(libseccomp)
|
BuildRequires: pkgconfig(libseccomp)
|
||||||
@ -211,6 +212,12 @@ make check
|
|||||||
%{_mandir}/*/man7/%{name}*
|
%{_mandir}/*/man7/%{name}*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Nov 19 2021 wangfengtu<wangfengtu@huawei.com> - 4.0.3-2021111901
|
||||||
|
- Type:bugfix
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:ensure that the idmap pointer itself is freed
|
||||||
|
|
||||||
* Thu Oct 21 2021 gaohuatao<gaohuatao@huawei.com> - 4.0.3-2021102101
|
* Thu Oct 21 2021 gaohuatao<gaohuatao@huawei.com> - 4.0.3-2021102101
|
||||||
- Type:bugfix
|
- Type:bugfix
|
||||||
- ID:NA
|
- ID:NA
|
||||||
|
|||||||
@ -30,3 +30,4 @@
|
|||||||
0030-conf-fix-a-memory-leak.patch
|
0030-conf-fix-a-memory-leak.patch
|
||||||
0031-fix-lsm_se_mount_context-memory-leak.patch
|
0031-fix-lsm_se_mount_context-memory-leak.patch
|
||||||
0032-disable-lxc_keep-with-oci-image.patch
|
0032-disable-lxc_keep-with-oci-image.patch
|
||||||
|
0033-conf-ensure-that-the-idmap-pointer-itself-is-freed.patch
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user