Skip to content

Commit da5b8b9

Browse files
Jozsef Kadlecsikgregkh
authored andcommitted
netfilter: ipset: Fix oversized kvmalloc() calls
commit 7bbc3d3 upstream. The commit commit 7661809 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent dedfc35 commit da5b8b9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎net/netfilter/ipset/ip_set_hash_gen.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,11 @@ htable_size(u8 hbits)
132132
{
133133
size_t hsize;
134134

135-
/* We must fit both into u32 in jhash and size_t */
135+
/* We must fit both into u32 in jhash and INT_MAX in kvmalloc_node() */
136136
if (hbits > 31)
137137
return 0;
138138
hsize = jhash_size(hbits);
139-
if ((((size_t)-1) - sizeof(struct htable)) / sizeof(struct hbucket *)
139+
if ((INT_MAX - sizeof(struct htable)) / sizeof(struct hbucket *)
140140
< hsize)
141141
return 0;
142142

0 commit comments

Comments
 (0)