Merge tag 'usercopy-v4.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees...
[linux-2.6-block.git] / mm / slub.c
index 862d835b30423d4e8a93bd49e948033823a01814..cc71176c6eeff4e3d5dbd04668c4485b582a6b34 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -838,6 +838,7 @@ static int slab_pad_check(struct kmem_cache *s, struct page *page)
        u8 *start;
        u8 *fault;
        u8 *end;
+       u8 *pad;
        int length;
        int remainder;
 
@@ -851,8 +852,9 @@ static int slab_pad_check(struct kmem_cache *s, struct page *page)
        if (!remainder)
                return 1;
 
+       pad = end - remainder;
        metadata_access_enable();
-       fault = memchr_inv(end - remainder, POISON_INUSE, remainder);
+       fault = memchr_inv(pad, POISON_INUSE, remainder);
        metadata_access_disable();
        if (!fault)
                return 1;
@@ -860,9 +862,9 @@ static int slab_pad_check(struct kmem_cache *s, struct page *page)
                end--;
 
        slab_err(s, page, "Padding overwritten. 0x%p-0x%p", fault, end - 1);
-       print_section(KERN_ERR, "Padding ", end - remainder, remainder);
+       print_section(KERN_ERR, "Padding ", pad, remainder);
 
-       restore_bytes(s, "slab padding", POISON_INUSE, end - remainder, end);
+       restore_bytes(s, "slab padding", POISON_INUSE, fault, end);
        return 0;
 }
 
@@ -2220,9 +2222,7 @@ static void unfreeze_partials(struct kmem_cache *s,
 
 /*
  * Put a page that was just frozen (in __slab_free) into a partial page
- * slot if available. This is done without interrupts disabled and without
- * preemption disabled. The cmpxchg is racy and may put the partial page
- * onto a random cpus partial slot.
+ * slot if available.
  *
  * If we did not find a slot then simply move all the partials to the
  * per node partial list.