Skip to content

Commit

Permalink
selinux: Add __GFP_NOWARN to allocation at str_read()
Browse files Browse the repository at this point in the history
syzbot is hitting warning at str_read() [1] because len parameter can
become larger than KMALLOC_MAX_SIZE. We don't need to emit warning for
this case.

[1] https://syzkaller.appspot.com/bug?id=7f2f5aad79ea8663c296a2eedb81978401a908f0

Signed-off-by: Tetsuo Handa <[email protected]>
Reported-by: syzbot <[email protected]>
Signed-off-by: Paul Moore <[email protected]>
  • Loading branch information
Tetsuo Handa authored and pcmoore committed Sep 13, 2018
1 parent 95ffe19 commit 4458bba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion security/selinux/ss/policydb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,7 @@ static int str_read(char **strp, gfp_t flags, void *fp, u32 len)
if ((len == 0) || (len == (u32)-1))
return -EINVAL;

str = kmalloc(len + 1, flags);
str = kmalloc(len + 1, flags | __GFP_NOWARN);
if (!str)
return -ENOMEM;

Expand Down

0 comments on commit 4458bba

Please sign in to comment.