]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
tty: serial: samsung_tty: avoid dev_dbg deadlock
authorAlyssa Milburn <amilburn@zall.org>
Wed, 28 Jan 2026 11:28:54 +0000 (11:28 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Mar 2026 14:05:10 +0000 (15:05 +0100)
commit a05025d0ce72 ("tty: serial: samsung_tty: use standard
debugging macros") changed the debug prints to dev_dbg, which can
result in deadlocks:

s3c24xx_serial_set_termios can be called with the port lock, and then
calls dev_dbg, which needs the console mutex. At the same time,
s3c24xx_serial_console_write can be called with the console lock
(e.g., inside console_unlock), and needs the port lock.

To avoid this, move one dev_dbg call and just delete the other.

Signed-off-by: Alyssa Milburn <amilburn@zall.org>
Link: https://patch.msgid.link/aXny9km6N1v9eoXU@zall.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/samsung_tty.c

index c1fabad6ba1faf6b6c38dec2eb459fa1c44257d2..e27806bf2cf3e571599444373b9ca07e9d61f0ad 100644 (file)
@@ -1562,12 +1562,12 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
                ulcon |= S3C2410_LCON_PNONE;
        }
 
-       uart_port_lock_irqsave(port, &flags);
-
        dev_dbg(port->dev,
                "setting ulcon to %08x, brddiv to %d, udivslot %08x\n",
                ulcon, quot, udivslot);
 
+       uart_port_lock_irqsave(port, &flags);
+
        wr_regl(port, S3C2410_ULCON, ulcon);
        wr_regl(port, S3C2410_UBRDIV, quot);
 
@@ -1587,12 +1587,6 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
        if (ourport->info->has_divslot)
                wr_regl(port, S3C2443_DIVSLOT, udivslot);
 
-       dev_dbg(port->dev,
-               "uart: ulcon = 0x%08x, ucon = 0x%08x, ufcon = 0x%08x\n",
-               rd_regl(port, S3C2410_ULCON),
-               rd_regl(port, S3C2410_UCON),
-               rd_regl(port, S3C2410_UFCON));
-
        /*
         * Update the per-port timeout.
         */