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-prev] [day] [month] [year] [list]
Date:   Sun, 12 Dec 2021 20:32:44 -0800
From:   Joe Perches <joe@...ches.com>
To:     Xiaoke Wang <xkernel.wang@...mail.com>, tj@...nel.org,
        lizefan.x@...edance.com, hannes@...xchg.org
Cc:     cgroups@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] cgroup: check the return value of kstrdup()

On Mon, 2021-12-13 at 11:30 +0800, Xiaoke Wang wrote:
> 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.
[]
> diff --git 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;
> +

Did you read all the other code that uses this?
Does it matter if it's NULL?
Why is it created with kstrdup in the first place?
Why should agent be anything other than const char *?
If it's const char * it shouldn't need to be used with
kstrdup/kfree.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ