vprintk_emit prefix parsing should only be done for internal kernel messages. This allows existing behavior to be kept in all cases.
Signed-off-by: Joe Perches joe@perches.com --- kernel/printk.c | 32 +++++++++++++++++--------------- 1 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/kernel/printk.c b/kernel/printk.c index 5cd73f7..4e72c07 100644 --- a/kernel/printk.c +++ b/kernel/printk.c @@ -1267,7 +1267,6 @@ asmlinkage int vprintk_emit(int facility, int level, static char cont_buf[LOG_LINE_MAX]; static size_t cont_len; static int cont_level; - int kern_level; static struct task_struct *cont_task; static char textbuf[LOG_LINE_MAX]; char *text = textbuf; @@ -1329,21 +1328,24 @@ asmlinkage int vprintk_emit(int facility, int level, newline = true; }
- /* strip syslog prefix and extract log level or control flags */ - kern_level = printk_get_level(text); - if (kern_level) { - const char *end_of_header = printk_skip_level(text); - switch (kern_level) { - case '0' ... '7': - if (level == -1) - level = kern_level - '0'; - case 'd': /* KERN_DEFAULT */ - prefix = true; - case 'c': /* KERN_CONT */ - break; + /* strip kernel syslog prefix and extract log level or control flags */ + if (facility == 0) { + int kern_level = printk_get_level(text); + + if (kern_level) { + const char *end_of_header = printk_skip_level(text); + switch (kern_level) { + case '0' ... '7': + if (level == -1) + level = kern_level - '0'; + case 'd': /* KERN_DEFAULT */ + prefix = true; + case 'c': /* KERN_CONT */ + break; + } + text_len -= end_of_header - text; + text = (char *)end_of_header; } - text_len -= end_of_header - text; - text = (char *)end_of_header; }
if (level == -1)