Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c185f05 authored by Kyle Yan's avatar Kyle Yan Committed by Gerrit - the friendly Code Review server
Browse files

Merge "mm: slub: panic for object and slab errors" into msm-4.9

parents a1f22f47 dac9c388
Loading
Loading
Loading
Loading
+12 −4
Original line number Original line Diff line number Diff line
@@ -663,11 +663,21 @@ static void print_trailer(struct kmem_cache *s, struct page *page, u8 *p)
	dump_stack();
	dump_stack();
}
}


#ifdef CONFIG_SLUB_DEBUG_PANIC_ON
static void slab_panic(const char *cause)
{
	panic("%s\n", cause);
}
#else
static inline void slab_panic(const char *cause) {}
#endif

void object_err(struct kmem_cache *s, struct page *page,
void object_err(struct kmem_cache *s, struct page *page,
			u8 *object, char *reason)
			u8 *object, char *reason)
{
{
	slab_bug(s, "%s", reason);
	slab_bug(s, "%s", reason);
	print_trailer(s, page, object);
	print_trailer(s, page, object);
	slab_panic(reason);
}
}


static void slab_err(struct kmem_cache *s, struct page *page,
static void slab_err(struct kmem_cache *s, struct page *page,
@@ -682,6 +692,7 @@ static void slab_err(struct kmem_cache *s, struct page *page,
	slab_bug(s, "%s", buf);
	slab_bug(s, "%s", buf);
	print_page_info(page);
	print_page_info(page);
	dump_stack();
	dump_stack();
	slab_panic("slab error");
}
}


static void init_object(struct kmem_cache *s, void *object, u8 val)
static void init_object(struct kmem_cache *s, void *object, u8 val)
@@ -703,12 +714,9 @@ static void init_object(struct kmem_cache *s, void *object, u8 val)
static void restore_bytes(struct kmem_cache *s, char *message, u8 data,
static void restore_bytes(struct kmem_cache *s, char *message, u8 data,
						void *from, void *to)
						void *from, void *to)
{
{
#ifdef CONFIG_SLUB_DEBUG_PANIC_ON
	slab_panic("object poison overwritten");
	panic("Found corruption 0x%p-0x%p=0x%x\n", from, to - 1, data);
#else
	slab_fix(s, "Restoring 0x%p-0x%p=0x%x\n", from, to - 1, data);
	slab_fix(s, "Restoring 0x%p-0x%p=0x%x\n", from, to - 1, data);
	memset(from, data, to - from);
	memset(from, data, to - from);
#endif
}
}


static int check_bytes_and_report(struct kmem_cache *s, struct page *page,
static int check_bytes_and_report(struct kmem_cache *s, struct page *page,