The patch titled Subject: mm: (k)vrealloc: document concurrency restrictions has been added to the -mm mm-unstable branch. Its filename is mm-kvmalloc-align-kvrealloc-with-krealloc-fix.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-kvmalloc-align-kvrealloc-with-krealloc-fix.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Danilo Krummrich <dakr@xxxxxxxxxx> Subject: mm: (k)vrealloc: document concurrency restrictions Date: Thu, 25 Jul 2024 14:54:37 +0200 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@xxxxxxxxxx Suggested-by: Christoph Hellwig <hch@xxxxxxxxxxxxx> Suggested-by: Uladzislau Rezki <urezki@xxxxxxxxx> Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/util.c | 3 +++ 1 file changed, 3 insertions(+) --- a/mm/util.c~mm-kvmalloc-align-kvrealloc-with-krealloc-fix +++ a/mm/util.c @@ -732,6 +732,9 @@ EXPORT_SYMBOL(kvfree_sensitive); * If @p is %NULL, kvrealloc() behaves exactly like kvmalloc(). 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 kvfree() for the + * same memory allocation. + * * Return: pointer to the allocated memory or %NULL in case of error */ void *kvrealloc_noprof(const void *p, size_t size, gfp_t flags) _ Patches currently in -mm which might be from dakr@xxxxxxxxxx are mm-vmalloc-implement-vrealloc.patch mm-vmalloc-implement-vrealloc-fix.patch mm-vmalloc-implement-vrealloc-fix-2.patch mm-kvmalloc-align-kvrealloc-with-krealloc.patch mm-kvmalloc-align-kvrealloc-with-krealloc-fix.patch