!509 [sync] PR-508: check cgroup path empty while setting freezer

* check cgroup path empty while setting freezer
This commit is contained in:
openeuler-sync-bot 2023-12-20 06:08:26 +00:00 committed by haozi007
parent ac6ff36360
commit 00993408ce
2 changed files with 42 additions and 1 deletions

View File

@ -0,0 +1,34 @@
From 6085c67cce5d4c5495e9a585d137b79af1b1598e Mon Sep 17 00:00:00 2001
From: jikai <jikai11@huawei.com>
Date: Tue, 19 Dec 2023 15:41:05 +0800
Subject: [PATCH] check cgroup path empty while setting freezer
Signed-off-by: jikai <jikai11@huawei.com>
---
src/lxc/start.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/lxc/start.c b/src/lxc/start.c
index ec64546..c01eb9b 100644
--- a/src/lxc/start.c
+++ b/src/lxc/start.c
@@ -1020,9 +1020,15 @@ static int get_all_pids(struct cgroup_ops *cg_ops, pid_t **pids, size_t *len)
static int set_cgroup_freezer(struct cgroup_ops *cg_ops, const char *value)
{
char *fullpath;
+ const char *cgroup_path;
int ret;
- fullpath = must_make_path(cg_ops->get_cgroup_full_path(cg_ops, "freezer"), "freezer.state", NULL);
+ cgroup_path = cg_ops->get_cgroup_full_path(cg_ops, "freezer");
+ if (cgroup_path == NULL) {
+ return -1;
+ }
+
+ fullpath = must_make_path(cgroup_path, "freezer.state", NULL);
ret = lxc_write_to_file(fullpath, value, strlen(value), false, 0666);
free(fullpath);
return ret;
--
2.33.0

View File

@ -1,4 +1,4 @@
%global _release 2022102424
%global _release 2022102425
Name: lxc
Version: 4.0.3
@ -45,6 +45,7 @@ Patch0034: 0034-add-secure-compile-macro.patch
Patch0035: 0035-codecheck-fix.patch
Patch0036: 0036-containers-in-the-FREEZING-state-also-need-to-be-unf.patch
Patch0037: 0037-Add-succeed-message-info-for-ocihook.patch
Patch0038: 0038-check-cgroup-path-empty-while-setting-freezer.patch
BuildRequires: systemd-units git libtool graphviz docbook2X doxygen chrpath
BuildRequires: pkgconfig(libseccomp)
@ -231,6 +232,12 @@ rm -rf %{buildroot}%{_sysconfdir}/default/%{name}
%endif
%changelog
* Tue Dec 19 2023 jikai<jikai11@huawei.com> - 4.0.3-2022102425
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: check cgroup path empty while setting freezer
* Tue Nov 7 2023 jikai<jikai11@huawei.com> - 4.0.3-2022102424
- Type:enhancement
- ID:NA