From c12b6fe5f1d958b9cee33c76993a282943361915 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Wed, 3 May 2017 11:38:54 -0400 Subject: [PATCH] bug on cache_from_obj !PageSlab check Signed-off-by: Daniel Micay Signed-off-by: anupritaisno1 --- mm/slab.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/slab.h b/mm/slab.h index ad457ec12..c17182db8 100755 --- a/mm/slab.h +++ b/mm/slab.h @@ -478,9 +478,13 @@ static inline struct kmem_cache *virt_to_cache(const void *obj) struct page *page; page = virt_to_head_page(obj); +#ifdef CONFIG_BUG_ON_DATA_CORRUPTION + BUG_ON(!PageSlab(page)); +#else if (WARN_ONCE(!PageSlab(page), "%s: Object is not a Slab page!\n", __func__)) return NULL; +#endif return page->slab_cache; }