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

Commit 46e00372 authored by Patrick Daly's avatar Patrick Daly Committed by Gerrit - the friendly Code Review server
Browse files

of: reserved_mem: Fix kmemleak crash on no-map region



Unable to handle kernel paging request at virtual address
[<ffffff849b434d88>] scan_block+0x88/0x170
[<ffffff849b435070>] scan_gray_list+0x18c/0x1c0
[<ffffff849b4352ac>] kmemleak_scan+0x208/0x4b0
[<ffffff849b4359ec>] kmemleak_write+0x338/0x378
[<ffffff849b571068>] full_proxy_write+0x80/0xe4
[<ffffff849b43fe7c>] vfs_write+0xb4/0x1d0

early_init_dt_alloc_reserved_memory_arch() calls memblock_alloc_base(),
which will create a kmemleak entry. Ensure this entry is ignored if
the no-map property is set. This will prevent kmemleak from scanning
the object if there is no kernel mapping for it.

Change-Id: I45f35600ae2aacf0f10f8bcbc956d019b666e4a7
Signed-off-by: default avatarPatrick Daly <pdaly@codeaurora.org>
Signed-off-by: default avatarSudarshan Rajagopalan <sudaraja@codeaurora.org>
parent 26ca81d6
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -24,6 +24,7 @@
#include <linux/of_reserved_mem.h>
#include <linux/of_reserved_mem.h>
#include <linux/sort.h>
#include <linux/sort.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/kmemleak.h>


#define MAX_RESERVED_REGIONS	32
#define MAX_RESERVED_REGIONS	32
static struct reserved_mem reserved_mem[MAX_RESERVED_REGIONS];
static struct reserved_mem reserved_mem[MAX_RESERVED_REGIONS];
@@ -54,8 +55,10 @@ int __init __weak early_init_dt_alloc_reserved_memory_arch(phys_addr_t size,
	}
	}


	*res_base = base;
	*res_base = base;
	if (nomap)
	if (nomap) {
		kmemleak_ignore_phys(base);
		return memblock_remove(base, size);
		return memblock_remove(base, size);
	}
	return 0;
	return 0;
}
}
#else
#else