mm: fix wrong kasan report [1/1]
authorTao Zeng <tao.zeng@amlogic.com>
Wed, 28 Aug 2019 07:25:40 +0000 (15:25 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Thu, 29 Aug 2019 06:36:43 +0000 (23:36 -0700)
commitbecb83999e19d2055458f08a2b7a44bd1170853e
tree36356830d39974b3d21f579a1d49723fb54e3c3d
parent6a108be69d58805c6bc426f78e645d8abb7d5cf8
mm: fix wrong kasan report [1/1]

PD#SWPL-13281

Problem:
There are 2 types of wrong kasan report after merge change of
save wasted slab.
1, slab-out-of-bounds, which is caused by krealloc set shadow
   memory out-of-range, since tail of page was freed.
2, use-after-free, which is caused by kasan_free_pages called
   after a page freed. Because this function already called in
   free_page, so it marked shadow memory twice.

Solution:
1, make shadow do not out of range if a tail page was freed and
   been realloc again.
2, remove call of kasan_free_pages.

Verify:
X301

Change-Id: Ib5bdcbb618a783920009bb97d112c361888b0d7c
Signed-off-by: Tao Zeng <tao.zeng@amlogic.com>
drivers/amlogic/memory_ext/Kconfig
mm/kasan/kasan.c
mm/page_alloc.c
mm/slub.c