Patch "serial: core: Keep mctrl register state and cached copy in sync" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    serial: core: Keep mctrl register state and cached copy in sync

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     serial-core-keep-mctrl-register-state-and-cached-cop.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 148db6a691bf78d59ab2018e28749a0dac00a495
Author: Lukas Wunner <lukas@xxxxxxxxx>
Date:   Sun Jan 2 18:52:44 2022 +0100

    serial: core: Keep mctrl register state and cached copy in sync
    
    [ Upstream commit 93a770b7e16772530196674ffc79bb13fa927dc6 ]
    
    struct uart_port contains a cached copy of the Modem Control signals.
    It is used to skip register writes in uart_update_mctrl() if the new
    signal state equals the old signal state.  It also avoids a register
    read to obtain the current state of output signals.
    
    When a uart_port is registered, uart_configure_port() changes signal
    state but neglects to keep the cached copy in sync.  That may cause
    a subsequent register write to be incorrectly skipped.  Fix it before
    it trips somebody up.
    
    This behavior has been present ever since the serial core was introduced
    in 2002:
    https://git.kernel.org/history/history/c/33c0d1b0c3eb
    
    So far it was never an issue because the cached copy is initialized to 0
    by kzalloc() and when uart_configure_port() is executed, at most DTR has
    been set by uart_set_options() or sunsu_console_setup().  Therefore,
    a stable designation seems unnecessary.
    
    Signed-off-by: Lukas Wunner <lukas@xxxxxxxxx>
    Link: https://lore.kernel.org/r/bceeaba030b028ed810272d55d5fc6f3656ddddb.1641129752.git.lukas@xxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 046bedca7b8f5..55108db5b64bf 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -2414,7 +2414,8 @@ uart_configure_port(struct uart_driver *drv, struct uart_state *state,
 		 * We probably don't need a spinlock around this, but
 		 */
 		spin_lock_irqsave(&port->lock, flags);
-		port->ops->set_mctrl(port, port->mctrl & TIOCM_DTR);
+		port->mctrl &= TIOCM_DTR;
+		port->ops->set_mctrl(port, port->mctrl);
 		spin_unlock_irqrestore(&port->lock, flags);
 
 		/*



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux