Skip to content

Commit 7fba942

Browse files
Tetsuo Handaakpm00
authored andcommitted
mm: shrinker: use kvzalloc_node() from expand_one_shrinker_info()
syzbot is reporting uninit-value at shrinker_alloc(), for commit 307bece ("mm: shrinker: add a secondary array for shrinker_info::{map, nr_deferred}") which assumed that the ->unit was allocated with __GFP_ZERO forgot to replace kvmalloc_node() in expand_one_shrinker_info() with kvzalloc_node(). Link: https://lkml.kernel.org/r/9226cc0a-10e0-4489-80c5-58c3b5b4359c@I-love.SAKURA.ne.jp Reported-by: syzbot <syzbot+1e0ed05798af62917464@syzkaller.appspotmail.com> Closes: https://syzkaller.appspot.com/bug?extid=1e0ed05798af62917464 Fixes: 307bece ("mm: shrinker: add a secondary array for shrinker_info::{map, nr_deferred}") Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Acked-by: Qi Zheng <zhengqi.arch@bytedance.com> Cc: Muchun Song <songmuchun@bytedance.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 5b8fbf5 commit 7fba942

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/shrinker.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ static int expand_one_shrinker_info(struct mem_cgroup *memcg, int new_size,
126126
if (new_nr_max <= old->map_nr_max)
127127
continue;
128128

129-
new = kvmalloc_node(sizeof(*new) + new_size, GFP_KERNEL, nid);
129+
new = kvzalloc_node(sizeof(*new) + new_size, GFP_KERNEL, nid);
130130
if (!new)
131131
return -ENOMEM;
132132

0 commit comments

Comments
 (0)