Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

serial: 8250: Protect LCR write in shutdown

The 8250_dw driver needs to potentially perform very complex operations
during LCR writes because its BUSY handling prevents updates to LCR
while UART is BUSY (which is not fully under our control without those
complex operations). Thus, LCR writes should occur under port's lock.

Move LCR write under port's lock in serial8250_do_shutdown(). Also
split the LCR RMW so that the logic is on a separate line for clarity.

Reported-by: Bandal, Shankar <shankar.bandal@intel.com>
Tested-by: Bandal, Shankar <shankar.bandal@intel.com>
Tested-by: Murthy, Shanth <shanth.murthy@intel.com>
Cc: stable <stable@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://patch.msgid.link/20260203171049.4353-2-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Ilpo Järvinen and committed by
Greg Kroah-Hartman
59a33d83 9c0072bc

+6 -5
+6 -5
drivers/tty/serial/8250/8250_port.c
··· 2348 2348 void serial8250_do_shutdown(struct uart_port *port) 2349 2349 { 2350 2350 struct uart_8250_port *up = up_to_u8250p(port); 2351 + u32 lcr; 2351 2352 2352 2353 serial8250_rpm_get(up); 2353 2354 /* ··· 2375 2374 port->mctrl &= ~TIOCM_OUT2; 2376 2375 2377 2376 serial8250_set_mctrl(port, port->mctrl); 2377 + 2378 + /* Disable break condition */ 2379 + lcr = serial_port_in(port, UART_LCR); 2380 + lcr &= ~UART_LCR_SBC; 2381 + serial_port_out(port, UART_LCR, lcr); 2378 2382 } 2379 2383 2380 - /* 2381 - * Disable break condition and FIFOs 2382 - */ 2383 - serial_port_out(port, UART_LCR, 2384 - serial_port_in(port, UART_LCR) & ~UART_LCR_SBC); 2385 2384 serial8250_clear_fifos(up); 2386 2385 2387 2386 rsa_disable(up);