]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm: kvrealloc: disable KASAN when switching to vmalloc
authorDanilo Krummrich <dakr@kernel.org>
Tue, 30 Jul 2024 18:49:41 +0000 (20:49 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 17 Aug 2024 00:52:22 +0000 (17:52 -0700)
Disable KASAN accessibility checks when switching from a kmalloc buffer
to a vmalloc buffer.

Link: https://lkml.kernel.org/r/20240730185049.6244-2-dakr@kernel.org
Fixes: 923a26b4c679 ("mm: kvmalloc: align kvrealloc() with krealloc()")
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/util.c

index f4b1672e6b75fb6d8f46059281d88cef7c801590..d98833e45e7cad5701f664151828d66330af9a18 100644 (file)
--- a/mm/util.c
+++ b/mm/util.c
@@ -753,7 +753,10 @@ void *kvrealloc_noprof(const void *p, size_t size, gfp_t flags)
 
                if (p) {
                        /* We already know that `p` is not a vmalloc address. */
-                       memcpy(n, p, ksize(p));
+                       kasan_disable_current();
+                       memcpy(n, kasan_reset_tag(p), ksize(p));
+                       kasan_enable_current();
+
                        kfree(p);
                }
        }