]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mm, kasan: don't call kasan_krealloc() from ksize().
authorAlexander Potapenko <glider@google.com>
Fri, 20 May 2016 23:59:14 +0000 (16:59 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 21 May 2016 00:58:30 +0000 (17:58 -0700)
Instead of calling kasan_krealloc(), which replaces the memory
allocation stack ID (if stack depot is used), just unpoison the whole
memory chunk.

Signed-off-by: Alexander Potapenko <glider@google.com>
Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Andrey Konovalov <adech.fo@gmail.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Konstantin Serebryany <kcc@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/slab.c
mm/slub.c

index 28864c0224300562b4dc8cf4098b6e87eb5b51cf..cc8bbc1e6bc9b6fe5d980ffe3837d7b4c8843d84 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -4501,7 +4501,7 @@ size_t ksize(const void *objp)
        /* We assume that ksize callers could use the whole allocated area,
         * so we need to unpoison this area.
         */
-       kasan_krealloc(objp, size, GFP_NOWAIT);
+       kasan_unpoison_shadow(objp, size);
 
        return size;
 }
index cf1faa4d3992520ead5dd61deed5e7c41ef9175a..825ff4505336e0a067a0ec297be96108cf6eaf23 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -3635,8 +3635,9 @@ size_t ksize(const void *object)
 {
        size_t size = __ksize(object);
        /* We assume that ksize callers could use whole allocated area,
-          so we need unpoison this area. */
-       kasan_krealloc(object, size, GFP_NOWAIT);
+        * so we need to unpoison this area.
+        */
+       kasan_unpoison_shadow(object, size);
        return size;
 }
 EXPORT_SYMBOL(ksize);