aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 5af2b8bc88f0..9b896e7a50a9 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1859,10 +1859,16 @@ asmlinkage __visible int printk(const char *fmt, ...)
1859 int r; 1859 int r;
1860 1860
1861 va_start(args, fmt); 1861 va_start(args, fmt);
1862 preempt_disable(); 1862
1863 /*
1864 * If a caller overrides the per_cpu printk_func, then it needs
1865 * to disable preemption when calling printk(). Otherwise
1866 * the printk_func should be set to the default. No need to
1867 * disable preemption here.
1868 */
1863 vprintk_func = this_cpu_read(printk_func); 1869 vprintk_func = this_cpu_read(printk_func);
1864 r = vprintk_func(fmt, args); 1870 r = vprintk_func(fmt, args);
1865 preempt_enable(); 1871
1866 va_end(args); 1872 va_end(args);
1867 1873
1868 return r; 1874 return r;