aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/printk
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/printk')
-rw-r--r--kernel/printk/printk.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index f900dc9f6822..02d6b6d28796 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1857,10 +1857,16 @@ asmlinkage __visible int printk(const char *fmt, ...)
1857 int r; 1857 int r;
1858 1858
1859 va_start(args, fmt); 1859 va_start(args, fmt);
1860 preempt_disable(); 1860
1861 /*
1862 * If a caller overrides the per_cpu printk_func, then it needs
1863 * to disable preemption when calling printk(). Otherwise
1864 * the printk_func should be set to the default. No need to
1865 * disable preemption here.
1866 */
1861 vprintk_func = this_cpu_read(printk_func); 1867 vprintk_func = this_cpu_read(printk_func);
1862 r = vprintk_func(fmt, args); 1868 r = vprintk_func(fmt, args);
1863 preempt_enable(); 1869
1864 va_end(args); 1870 va_end(args);
1865 1871
1866 return r; 1872 return r;