ANDROID: kasan: fix slab page check in complete_report_info

The backport commit 77a0deb5d5 ("BACKPORT: kasan: fill in cache and
object in complete_report_info") did not resolve the conflict due to the
folio patchset missing in 5.15 correctly: complete_report_info needs to
check PageSlab to make sure that the page is a slab page.

Add a PageSlab check to complete_report_info.

Bug: 254721825
Reported-by: Peter Collingbourne <pcc@google.com>
Fixes: 77a0deb5d5 ("BACKPORT: kasan: fill in cache and object in complete_report_info")
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Change-Id: I307ddbd9315134f825b37a0c7254a033453a46ef
This commit is contained in:
Andrey Konovalov
2023-02-10 00:01:43 +01:00
parent 93f59126f9
commit f34aed1750

View File

@@ -407,7 +407,7 @@ static void complete_report_info(struct kasan_report_info *info)
info->first_bad_addr = addr;
page = kasan_addr_to_page(addr);
if (page && page->slab_cache) {
if (page && PageSlab(page) && page->slab_cache) {
info->cache = page->slab_cache;
info->object = nearest_obj(info->cache, page, addr);
} else