Skip to content
Commit e9adaed2 authored by Alexander Potapenko's avatar Alexander Potapenko Committed by Greg Kroah-Hartman
Browse files

kfence: move the size check to the beginning of __kfence_alloc()

commit 235a85cb upstream.

Check the allocation size before toggling kfence_allocation_gate.

This way allocations that can't be served by KFENCE will not result in
waiting for another CONFIG_KFENCE_SAMPLE_INTERVAL without allocating
anything.

Link: https://lkml.kernel.org/r/20210714092222.1890268-1-glider@google.com


Signed-off-by: default avatarAlexander Potapenko <glider@google.com>
Suggested-by: default avatarMarco Elver <elver@google.com>
Reviewed-by: default avatarMarco Elver <elver@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Marco Elver <elver@google.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: <stable@vger.kernel.org>	[5.12+]
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 60e7f63d
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment