summaryrefslogtreecommitdiff
authorTetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>2018-09-07 16:42:58 (GMT)
committer Greg Kroah-Hartman <gregkh@linuxfoundation.org>2018-12-01 08:44:18 (GMT)
commit47ff7629822ee2e1767f9c2886a47b1b075549f5 (patch)
tree4cea69bde0d9c07ce261b03e9d4f0220dfbbee3c
parent3a0e8e3587454c5f1c02b8450a4b71e517a7a1be (diff)
downloadcommon-47ff7629822ee2e1767f9c2886a47b1b075549f5.zip
common-47ff7629822ee2e1767f9c2886a47b1b075549f5.tar.gz
common-47ff7629822ee2e1767f9c2886a47b1b075549f5.tar.bz2
selinux: Add __GFP_NOWARN to allocation at str_read()
commit 4458bba09788e70e8fb39ad003f087cd9dfbd6ac upstream. 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 <penguin-kernel@I-love.SAKURA.ne.jp> Reported-by: syzbot <syzbot+ac488b9811036cea7ea0@syzkaller.appspotmail.com> Signed-off-by: Paul Moore <paul@paul-moore.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat
-rw-r--r--security/selinux/ss/policydb.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
index d719db4..175e4dc 100644
--- a/security/selinux/ss/policydb.c
+++ b/security/selinux/ss/policydb.c
@@ -1097,7 +1097,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;