mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 14:42:24 +00:00
netfilter: ipset: Fix oversized kvmalloc() calls
The commit
commit 7661809d49
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date: Wed Jul 14 09:45:49 2021 -0700
mm: don't allow oversized kvmalloc() calls
limits the max allocatable memory via kvmalloc() to MAX_INT. Apply the
same limit in ipset.
Reported-by: syzbot+3493b1873fb3ea827986@syzkaller.appspotmail.com
Reported-by: syzbot+2b8443c35458a617c904@syzkaller.appspotmail.com
Reported-by: syzbot+ee5cb15f4a0e85e0d54e@syzkaller.appspotmail.com
Signed-off-by: Jozsef Kadlecsik <kadlec@netfilter.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
276aae3772
commit
7bbc3d385b
@ -130,11 +130,11 @@ htable_size(u8 hbits)
|
||||
{
|
||||
size_t hsize;
|
||||
|
||||
/* We must fit both into u32 in jhash and size_t */
|
||||
/* We must fit both into u32 in jhash and INT_MAX in kvmalloc_node() */
|
||||
if (hbits > 31)
|
||||
return 0;
|
||||
hsize = jhash_size(hbits);
|
||||
if ((((size_t)-1) - sizeof(struct htable)) / sizeof(struct hbucket *)
|
||||
if ((INT_MAX - sizeof(struct htable)) / sizeof(struct hbucket *)
|
||||
< hsize)
|
||||
return 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user