diff options
author | Marco Elver <elver@google.com> | 2021-03-04 21:52:56 +0100 |
---|---|---|
committer | Sung-hun Kim <sfoon.kim@samsung.com> | 2021-10-20 10:17:15 +0900 |
commit | d16b578a2d4d09a1ff11eaf4124152c6e31a663b (patch) | |
tree | 15c09987aa4379fdcd4e5ad242e0515738dbf2f6 /mm | |
parent | 6659d4ec39e482b8a93583234331dc3a21186f29 (diff) | |
download | linux-rpi-d16b578a2d4d09a1ff11eaf4124152c6e31a663b.tar.gz linux-rpi-d16b578a2d4d09a1ff11eaf4124152c6e31a663b.tar.bz2 linux-rpi-d16b578a2d4d09a1ff11eaf4124152c6e31a663b.zip |
kfence, slab: fix cache_alloc_debugcheck_after() for bulk allocations
cache_alloc_debugcheck_after() performs checks on an object, including
adjusting the returned pointer. None of this should apply to KFENCE
objects. While for non-bulk allocations, the checks are skipped when we
allocate via KFENCE, for bulk allocations cache_alloc_debugcheck_after()
is called via cache_alloc_debugcheck_after_bulk().
Fix it by skipping cache_alloc_debugcheck_after() for KFENCE objects.
Change-Id: I07e1131fb1659455be3ac7e65147e627de63520a
Signed-off-by: Marco Elver <elver@google.com>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/slab.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/slab.c b/mm/slab.c index a1c2809731c6..e99c1dbde084 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -2992,7 +2992,7 @@ static void *cache_alloc_debugcheck_after(struct kmem_cache *cachep, gfp_t flags, void *objp, unsigned long caller) { WARN_ON_ONCE(cachep->ctor && (flags & __GFP_ZERO)); - if (!objp) + if (!objp || is_kfence_address(objp)) return objp; if (cachep->flags & SLAB_POISON) { check_poison_obj(cachep, objp); |