提交 aabdbb1b 编写于 作者: J John Ogness 提交者: Greg Kroah-Hartman

serial: msm_serial: disable interrupts in __msm_console_write()

__msm_console_write() assumes that interrupts are disabled, but
with threaded console printers it is possible that the write()
callback of the console is called with interrupts enabled.

Explicitly disable interrupts using local_irq_save() to preserve
the assumed context.
Reported-by: NMarek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: NPetr Mladek <pmladek@suse.com>
Signed-off-by: NJohn Ogness <john.ogness@linutronix.de>
Link: https://lore.kernel.org/r/20220506213324.470461-1-john.ogness@linutronix.deSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 589f892a
...@@ -1599,6 +1599,7 @@ static inline struct uart_port *msm_get_port_from_line(unsigned int line) ...@@ -1599,6 +1599,7 @@ static inline struct uart_port *msm_get_port_from_line(unsigned int line)
static void __msm_console_write(struct uart_port *port, const char *s, static void __msm_console_write(struct uart_port *port, const char *s,
unsigned int count, bool is_uartdm) unsigned int count, bool is_uartdm)
{ {
unsigned long flags;
int i; int i;
int num_newlines = 0; int num_newlines = 0;
bool replaced = false; bool replaced = false;
...@@ -1616,6 +1617,8 @@ static void __msm_console_write(struct uart_port *port, const char *s, ...@@ -1616,6 +1617,8 @@ static void __msm_console_write(struct uart_port *port, const char *s,
num_newlines++; num_newlines++;
count += num_newlines; count += num_newlines;
local_irq_save(flags);
if (port->sysrq) if (port->sysrq)
locked = 0; locked = 0;
else if (oops_in_progress) else if (oops_in_progress)
...@@ -1661,6 +1664,8 @@ static void __msm_console_write(struct uart_port *port, const char *s, ...@@ -1661,6 +1664,8 @@ static void __msm_console_write(struct uart_port *port, const char *s,
if (locked) if (locked)
spin_unlock(&port->lock); spin_unlock(&port->lock);
local_irq_restore(flags);
} }
static void msm_console_write(struct console *co, const char *s, static void msm_console_write(struct console *co, const char *s,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册