In the Linux kernel, the following vulnerability has been resolved:
serial: core: respect runtime PM when sending x_char
__uart_start() calls the start_tx operation only if the port is runtime
active. Otherwise it asks for a resume, and
serial_port_runtime_resume() starts the transmitter.
uart_send_xchar() calls start_tx at once, under the port lock, whatever
the state of the device. With 8250_omap, serial8250_start_tx() then
calls pm_runtime_get_sync() for a suspended device: that sleeps, and
omap8250_runtime_resume() takes the port lock again. A tcflow(TCIOFF)
on an idle port is enough, if autosuspend has been enabled. It was
allowed as long as that driver used pm_runtime_irq_safe().
Share the part of __uart_start() that deals with runtime PM. A stopped
transmission still does not hold up an XON or XOFF character. Let a
pending x_char count as work for serial_port_runtime_resume(), and keep
the port from being suspended with it.