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

Commit 058c9685 authored by Matt Wagantall's avatar Matt Wagantall
Browse files

ARM: Improve vmalloc address checking in show_data()



There is an unhandled corner case with the current check
which has recently been hit. The nbytes argument may be
large enough for the range being dumped to cross a
boundary between page-table mappings, and dump addresses
which are vmalloc'd in the neighboring mapping.

Check every address being dumped to see if its vmalloc'd,
not just the address passed to show_data().

Change-Id: I255b093808177321f5202dcacea337ee333bfc63
Signed-off-by: default avatarMatt Wagantall <mattw@codeaurora.org>
parent 11e8434e
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -321,12 +321,10 @@ static void show_data(unsigned long addr, int nbytes, const char *name)
	u32	*p;

	/*
	 * don't attempt to dump non-kernel addresses, values that are probably
	 * just small negative numbers, or vmalloc addresses that may point to
	 * memory-mapped peripherals
	 * don't attempt to dump non-kernel addresses or
	 * values that are probably just small negative numbers
	 */
	if (addr < PAGE_OFFSET || addr > -256UL ||
	    is_vmalloc_addr((void *)addr))
	if (addr < PAGE_OFFSET || addr > -256UL)
		return;

	printk("\n%s: %#lx:\n", name, addr);
@@ -348,7 +346,12 @@ static void show_data(unsigned long addr, int nbytes, const char *name)
		printk("%04lx ", (unsigned long)p & 0xffff);
		for (j = 0; j < 8; j++) {
			u32	data;
			if (probe_kernel_address(p, data)) {
			/*
			 * vmalloc addresses may point to
			 * memory-mapped peripherals
			 */
			if (is_vmalloc_addr(p) ||
			    probe_kernel_address(p, data)) {
				printk(" ********");
			} else {
				printk(" %08x", data);