From: Danilo Krummrich Date: Thu, 25 Jul 2024 12:54:37 +0000 (+0200) Subject: mm: (k)vrealloc: document concurrency restrictions X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=f12a9702d5ef586bc4108bea268c3dabb848d48b;p=users%2Fjedix%2Flinux-maple.git 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 --- 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 */