lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_6410A5887F4B906866965C000E7A8AA3F007@qq.com>
Date:   Mon, 13 Dec 2021 11:30:42 +0800
From:   Xiaoke Wang <xkernel.wang@...mail.com>
To:     tj@...nel.org, lizefan.x@...edance.com, hannes@...xchg.org
Cc:     cgroups@...r.kernel.org, linux-kernel@...r.kernel.org,
        Xiaoke Wang <xkernel.wang@...mail.com>
Subject: [PATCH] cgroup: check the return value of kstrdup()

kstrdup() returns NULL when some internal memory errors happen, it is
better to check the return value of it so to catch the memory error in
time.

Signed-off-by: Xiaoke Wang <xkernel.wang@...mail.com>
---
 kernel/cgroup/cgroup.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index ea08f01..47c7d58 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -2228,6 +2228,9 @@ static int cpuset_init_fs_context(struct fs_context *fc)
 	struct cgroup_fs_context *ctx;
 	int err;
 
+	if (!agent)
+		return -ENOMEM;
+
 	err = cgroup_init_fs_context(fc);
 	if (err) {
 		kfree(agent);
-- 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ