mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-11-30 15:53:22 -05:00
netfilter: ipset: Fix oversized kvmalloc() calls
commit 7bbc3d385bd813077acaf0e6fdb2a86a901f5382 upstream. The commit commit 7661809d493b426e979f39ab512e3adf41fbcc69 Author: Linus Torvalds <[email protected]> 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: [email protected] Reported-by: [email protected] Reported-by: [email protected] Signed-off-by: Jozsef Kadlecsik <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
fe9bb925e7
commit
6f2f68640b
1 changed files with 2 additions and 2 deletions
|
|
@ -132,11 +132,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 a new issue