Skip to content

Commit 1bb8430

Browse files
xairyakpm00
authored andcommitted
kasan: document kasan_mempool_poison_object
Add documentation comment for kasan_mempool_poison_object. Link: https://lkml.kernel.org/r/af33ba8cabfa1ad731fe23a3f874bfc8d3b7fed4.1703024586.git.andreyknvl@google.com Signed-off-by: Andrey Konovalov <[email protected]> Cc: Alexander Lobakin <[email protected]> Cc: Alexander Potapenko <[email protected]> Cc: Andrey Ryabinin <[email protected]> Cc: Breno Leitao <[email protected]> Cc: Dmitry Vyukov <[email protected]> Cc: Evgenii Stepanov <[email protected]> Cc: Marco Elver <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 9b94fe9 commit 1bb8430

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

include/linux/kasan.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,24 @@ static __always_inline void * __must_check kasan_krealloc(const void *object,
213213
}
214214

215215
void __kasan_mempool_poison_object(void *ptr, unsigned long ip);
216+
/**
217+
* kasan_mempool_poison_object - Check and poison a mempool slab allocation.
218+
* @ptr: Pointer to the slab allocation.
219+
*
220+
* This function is intended for kernel subsystems that cache slab allocations
221+
* to reuse them instead of freeing them back to the slab allocator (e.g.
222+
* mempool).
223+
*
224+
* This function poisons a slab allocation without initializing its memory and
225+
* without putting it into the quarantine (for the Generic mode).
226+
*
227+
* This function also performs checks to detect double-free and invalid-free
228+
* bugs and reports them.
229+
*
230+
* This function operates on all slab allocations including large kmalloc
231+
* allocations (the ones returned by kmalloc_large() or by kmalloc() with the
232+
* size > KMALLOC_MAX_SIZE).
233+
*/
216234
static __always_inline void kasan_mempool_poison_object(void *ptr)
217235
{
218236
if (kasan_enabled())

0 commit comments

Comments
 (0)