tomoyo: Fix null pointer check
authorZheng Zengkai <zhengzengkai@huawei.com>
Thu, 26 Nov 2020 14:38:15 +0000 (22:38 +0800)
committerTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Fri, 27 Nov 2020 10:36:11 +0000 (19:36 +0900)
commit1b6b924efeb9e46f0ca2ebe5b9bb6b276defe52d
treed529074a7d8eba402d624f5b819c3e4b02f3e3b5
parente991a40b3d0000a2f48729aea4ce03acf679b5ee
tomoyo: Fix null pointer check

Since tomoyo_memory_ok() will check for null pointer returned by
kzalloc() in tomoyo_assign_profile(), tomoyo_assign_namespace(),
tomoyo_get_name() and tomoyo_commit_ok(), then emit OOM warnings
if needed. And this is the expected behavior as informed by
Tetsuo Handa.

Let's add __GFP_NOWARN to kzalloc() in those related functions.
Besides, to achieve this goal, remove the null check for entry
right after kzalloc() in tomoyo_assign_namespace().

Reported-by: Hulk Robot <hulkci@huawei.com>
Suggested-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com>
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
security/tomoyo/common.c
security/tomoyo/domain.c
security/tomoyo/memory.c