Skip to content

Commit 9ab71d9

Browse files
committed
selinux: add __GFP_NOWARN to hashtab_init() allocations
As reported by syzbot, hashtab_init() can be affected by abnormally large policy loads which would cause the kernel's allocator to emit a warning in some configurations. Since the SELinux hashtab_init() code handles the case where the allocation fails, due to a large request or some other reason, we can safely add the __GFP_NOWARN flag to squelch these abnormally large allocation warnings. Reported-by: syzbot+bc2c99c2929c3d219fb3@syzkaller.appspotmail.com Tested-by: syzbot+bc2c99c2929c3d219fb3@syzkaller.appspotmail.com Signed-off-by: Paul Moore <paul@paul-moore.com>
1 parent 951b2de commit 9ab71d9

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

security/selinux/ss/hashtab.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ int hashtab_init(struct hashtab *h, u32 nel_hint)
4040
h->htable = NULL;
4141

4242
if (size) {
43-
h->htable = kcalloc(size, sizeof(*h->htable), GFP_KERNEL);
43+
h->htable = kcalloc(size, sizeof(*h->htable),
44+
GFP_KERNEL | __GFP_NOWARN);
4445
if (!h->htable)
4546
return -ENOMEM;
4647
h->size = size;

0 commit comments

Comments
 (0)