Skip to content

Commit

Permalink
kasan: fix bad call to unpoison_slab_object
Browse files Browse the repository at this point in the history
Commit 29d7355 ("kasan: save alloc stack traces for mempool") messed
up one of the calls to unpoison_slab_object: the last two arguments are
supposed to be GFP flags and whether to init the object memory.

Fix the call.

Without this fix, __kasan_mempool_unpoison_object provides the object's
size as GFP flags to unpoison_slab_object, which can cause LOCKDEP reports
(and probably other issues).

Link: https://lkml.kernel.org/r/[email protected]
Fixes: 29d7355 ("kasan: save alloc stack traces for mempool")
Signed-off-by: Andrey Konovalov <[email protected]>
Reported-by: Brad Spengler <[email protected]>
Acked-by: Marco Elver <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
xairy authored and akpm00 committed Jun 25, 2024
1 parent 34a023d commit 1c61990
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/kasan/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ void __kasan_mempool_unpoison_object(void *ptr, size_t size, unsigned long ip)
return;

/* Unpoison the object and save alloc info for non-kmalloc() allocations. */
unpoison_slab_object(slab->slab_cache, ptr, size, flags);
unpoison_slab_object(slab->slab_cache, ptr, flags, false);

/* Poison the redzone and save alloc info for kmalloc() allocations. */
if (is_kmalloc_cache(slab->slab_cache))
Expand Down

0 comments on commit 1c61990

Please sign in to comment.