]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm: (k)vrealloc: document concurrency restrictions
authorDanilo Krummrich <dakr@kernel.org>
Thu, 25 Jul 2024 12:54:37 +0000 (14:54 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 17 Aug 2024 00:52:21 +0000 (17:52 -0700)
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 <dakr@kernel.org>
Suggested-by: Christoph Hellwig <hch@infradead.org>
Suggested-by: Uladzislau Rezki <urezki@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/vmalloc.c

index 371a84583d7fa27011483874e2daf94ed4cfbcca..f364bba9a5cb0f9e46b34e251b4d2867eacdaba2 100644 (file)
@@ -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
  */