summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-05-10 13:14:07 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-05-10 13:14:07 -0400
commite290e6af1d22c3f5225c9d46faabdde80e27aef2 (patch)
tree86c375ab968d11d35e5800f2e92309a68569a982 /lib
parent3232b43f7252e04efd703ca8ecb87e2567a36388 (diff)
parent2ac5a3bf7042a1c4abbcce1b6f0ec61e5d3786c2 (diff)
downloadlinux-e290e6af1d22c3f5225c9d46faabdde80e27aef2.tar.gz
linux-e290e6af1d22c3f5225c9d46faabdde80e27aef2.tar.bz2
linux-e290e6af1d22c3f5225c9d46faabdde80e27aef2.zip
Merge tag 'printk-for-5.2-fixes' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/pmladek/printk
Pull printk fixup from Petr Mladek: "Replace the problematic probe_kernel_read() with original simple pointer checks in vsprintf()" * tag 'printk-for-5.2-fixes' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/pmladek/printk: vsprintf: Do not break early boot with probing addresses
Diffstat (limited to 'lib')
-rw-r--r--lib/vsprintf.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 7b0a6140bfad..2f003cfe340e 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -628,19 +628,16 @@ static char *error_string(char *buf, char *end, const char *s,
}
/*
- * This is not a fool-proof test. 99% of the time that this will fault is
- * due to a bad pointer, not one that crosses into bad memory. Just test
- * the address to make sure it doesn't fault due to a poorly added printk
- * during debugging.
+ * Do not call any complex external code here. Nested printk()/vsprintf()
+ * might cause infinite loops. Failures might break printk() and would
+ * be hard to debug.
*/
static const char *check_pointer_msg(const void *ptr)
{
- char byte;
-
if (!ptr)
return "(null)";
- if (probe_kernel_address(ptr, byte))
+ if ((unsigned long)ptr < PAGE_SIZE || IS_ERR_VALUE(ptr))
return "(efault)";
return NULL;