Commit 5d682681 authored by Balasubramani Vivekanandan's avatar Balasubramani Vivekanandan Committed by Linus Torvalds
Browse files

mm/slub.c: fix wrong address during slab padding restoration

Start address calculated for slab padding restoration was wrong.  Wrong
address would point to some section before padding and could cause


Signed-off-by: default avatarBalasubramani Vivekanandan <>
Cc: Christoph Lameter <>
Cc: Pekka Enberg <>
Cc: David Rientjes <>
Cc: Joonsoo Kim <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 84ebb582
......@@ -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;
fault = memchr_inv(end - remainder, POISON_INUSE, remainder);
fault = memchr_inv(pad, POISON_INUSE, remainder);
if (!fault)
return 1;
......@@ -860,9 +862,9 @@ static int slab_pad_check(struct kmem_cache *s, struct page *page)
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;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment