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] [thread-next>] [day] [month] [year] [list]
Message-ID: <cfc96d99-adff-6eb9-9685-422587830eb8@i-love.sakura.ne.jp>
Date:   Wed, 25 Nov 2020 21:25:37 +0900
From:   Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>
To:     Zheng Zengkai <zhengzengkai@...wei.com>
Cc:     linux-security-module@...r.kernel.org,
        linux-kernel@...r.kernel.org, jmorris@...ei.org, serge@...lyn.com
Subject: Re: [PATCH] tomoyo: Avoid potential null pointer access

Hello, Zheng.

Thank you for a patch, but I won't apply this patch.
Expected behavior is that tomoyo_warn_oom() is called
if tomoyo_memory_ok() is called with entry == NULL.

Adding __GFP_NOWARN might be OK, but returning without tomoyo_warn_oom() is NG.

On 2020/11/25 21:10, Zheng Zengkai wrote:
> Calls to kzalloc() should be null-checked in order to avoid
> any potential failures or unnecessary code execution.
> Fix this by adding null checks for _entry_ right after allocation.
> 
> Fixes: 57c2590fb7fd ("TOMOYO: Update profile structure")
> Reported-by: Hulk Robot <hulkci@...wei.com>
> Signed-off-by: Zheng Zengkai <zhengzengkai@...wei.com>

Nacked-by: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>

> ---
>  security/tomoyo/common.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
> index 4bee32bfe16d..99b4fafcb100 100644
> --- a/security/tomoyo/common.c
> +++ b/security/tomoyo/common.c
> @@ -499,6 +499,8 @@ static struct tomoyo_profile *tomoyo_assign_profile
>  	if (ptr)
>  		return ptr;
>  	entry = kzalloc(sizeof(*entry), GFP_NOFS);
> +	if (!entry)
> +		return NULL;
>  	if (mutex_lock_interruptible(&tomoyo_policy_lock))
>  		goto out;
>  	ptr = ns->profile_ptr[profile];
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ