]> Git Repo - linux.git/commit - mm/util.c
mm: don't allow oversized kvmalloc() calls
authorLinus Torvalds <[email protected]>
Wed, 14 Jul 2021 16:45:49 +0000 (09:45 -0700)
committerLinus Torvalds <[email protected]>
Thu, 2 Sep 2021 16:47:01 +0000 (09:47 -0700)
commit7661809d493b426e979f39ab512e3adf41fbcc69
treee6aefba9862580081aee2c8538676a4637d54d20
parent111c1aa8cad4a0069dfe98fc093507b5b2cdfda7
mm: don't allow oversized kvmalloc() calls

'kvmalloc()' is a convenience function for people who want to do a
kmalloc() but fall back on vmalloc() if there aren't enough physically
contiguous pages, or if the allocation is larger than what kmalloc()
supports.

However, let's make sure it doesn't get _too_ easy to do crazy things
with it.  In particular, don't allow big allocations that could be due
to integer overflow or underflow.  So make sure the allocation size fits
in an 'int', to protect against trivial integer conversion issues.

Acked-by: Willy Tarreau <[email protected]>
Cc: Kees Cook <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/util.c
This page took 0.05593 seconds and 4 git commands to generate.