From f12a9702d5ef586bc4108bea268c3dabb848d48b Mon Sep 17 00:00:00 2001 From: Danilo Krummrich Date: Thu, 25 Jul 2024 14:54:37 +0200 Subject: [PATCH] mm: (k)vrealloc: document concurrency restrictions Document that concurrent calls to vrealloc() with itself or vfree() for the same memory allocation are not permitted, since it leads to undefined behavior. Consequently, the same applies for kvrealloc(), hence also document it for kvrealloc(). Link: https://lkml.kernel.org/r/20240725125442.4957-1-dakr@kernel.org Signed-off-by: Danilo Krummrich Suggested-by: Christoph Hellwig Suggested-by: Uladzislau Rezki Signed-off-by: Andrew Morton --- mm/vmalloc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 371a84583d7f..f364bba9a5cb 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -4042,6 +4042,9 @@ EXPORT_SYMBOL(vzalloc_node_noprof); * If @p is %NULL, vrealloc() behaves exactly like vmalloc(). If @size is 0 and * @p is not a %NULL pointer, the object pointed to is freed. * + * This function must not be called concurrently with itself or vfree() for the + * same memory allocation. + * * Return: pointer to the allocated memory; %NULL if @size is zero or in case of * failure */ -- 2.50.1