Re: [PATCH] tomoyo: Avoid potential null pointer access

2020-11-27 Thread Tetsuo Handa
On 2020/11/27 16:17, Zheng Zengkai wrote: > Hello Tetsuo, >> On 2020/11/26 15:33, Zheng Zengkai wrote: >>> As your say,  I found the function tomoyo_assign_namespace( ) >>> >>> in security/tomoyo/domain.c has the similar situation, >>> >>> Can I add __GFP_NOWARN for both and remove the null check

Re: [PATCH] tomoyo: Avoid potential null pointer access

2020-11-26 Thread Zheng Zengkai
Hello Tetsuo, On 2020/11/26 15:33, Zheng Zengkai wrote: As your say,  I found the function tomoyo_assign_namespace( ) in security/tomoyo/domain.c has the similar situation, Can I add __GFP_NOWARN for both and remove the null check for _entry_ in tomoyo_assign_namespace( )? Good catch. Yes,

Re: [PATCH] tomoyo: Avoid potential null pointer access

2020-11-25 Thread Tetsuo Handa
On 2020/11/26 15:33, Zheng Zengkai wrote: > As your say,  I found the function tomoyo_assign_namespace( ) > > in security/tomoyo/domain.c has the similar situation, > > Can I add __GFP_NOWARN for both and remove the null check for _entry_ in > tomoyo_assign_namespace( )? > Good catch. Yes,

Re: [PATCH] tomoyo: Avoid potential null pointer access

2020-11-25 Thread Zheng Zengkai
Hello, Tetsuo Got it , Thank you for your explanation. 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

Re: [PATCH] tomoyo: Avoid potential null pointer access

2020-11-25 Thread Tetsuo Handa
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:

[PATCH] tomoyo: Avoid potential null pointer access

2020-11-25 Thread Zheng Zengkai
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 Signed-off-by: Zheng Zengkai ---