Merge tag 'ucount-rlimit-for-v5.18' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-microblaze.git] / kernel / scs.c
index 579841b..b7e1b09 100644 (file)
@@ -32,15 +32,19 @@ static void *__scs_alloc(int node)
        for (i = 0; i < NR_CACHED_SCS; i++) {
                s = this_cpu_xchg(scs_cache[i], NULL);
                if (s) {
-                       kasan_unpoison_vmalloc(s, SCS_SIZE);
+                       s = kasan_unpoison_vmalloc(s, SCS_SIZE,
+                                                  KASAN_VMALLOC_PROT_NORMAL);
                        memset(s, 0, SCS_SIZE);
-                       return s;
+                       goto out;
                }
        }
 
-       return __vmalloc_node_range(SCS_SIZE, 1, VMALLOC_START, VMALLOC_END,
+       s = __vmalloc_node_range(SCS_SIZE, 1, VMALLOC_START, VMALLOC_END,
                                    GFP_SCS, PAGE_KERNEL, 0, node,
                                    __builtin_return_address(0));
+
+out:
+       return kasan_reset_tag(s);
 }
 
 void *scs_alloc(int node)
@@ -78,7 +82,7 @@ void scs_free(void *s)
                if (this_cpu_cmpxchg(scs_cache[i], 0, s) == NULL)
                        return;
 
-       kasan_unpoison_vmalloc(s, SCS_SIZE);
+       kasan_unpoison_vmalloc(s, SCS_SIZE, KASAN_VMALLOC_PROT_NORMAL);
        vfree_atomic(s);
 }