summaryrefslogtreecommitdiff
path: root/drivers/tty
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2026-10-27 12:06:45 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-11-03 13:28:53 +0100
commit6d7fbd5a28d092ab61ec0092cf1e085d2bb9ed7e (patch)
treeb75bdf18eac6f1012866bf8821c80d0cae6dfc21 /drivers/tty
parent0f0664a63efdfd70d1c555080781f4e8464445aa (diff)
serial: imx: fix the tty reference of the wakeup event
To report a wakeup event, imx_uart_enable_wakeup() gets the tty with tty_port_tty_get() and never puts it: each wakeup by the UART leaks a reference, and the tty is not freed when it is closed. Fixes: 0cfadf4bcd28 ("tty: serial: imx: Add missing wakeup event reporting") Cc: stable <stable@kernel.org> Cc: Jiri Slaby <jirislaby@kernel.org> Cc: Frank Li <Frank.Li@nxp.com> Cc: Sascha Hauer <s.hauer@pengutronix.de> Cc: Pengutronix Kernel Team <kernel@pengutronix.de> Cc: Fabio Estevam <festevam@gmail.com> Cc: Robin Gong <yibin.gong@nxp.com> Cc: Petr Mladek <pmladek@suse.com> Cc: John Ogness <john.ogness@linutronix.de> Cc: Pan Chuang <panchuang@vivo.com> Cc: Karl Mehltretter <kmehltretter@gmail.com> Cc: Sherry Sun <sherry.sun@nxp.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://patch.msgid.link/20261027-tty-llm-v1-19-99b0202ae546@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/imx.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 986fefb45c63..18892fc4a35b 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -2742,8 +2742,14 @@ static void imx_uart_enable_wakeup(struct imx_port *sport, bool on)
imx_uart_writel(sport, ucr1, UCR1);
}
- if (wake_active && irqd_is_wakeup_set(irq_get_irq_data(sport->port.irq)))
- pm_wakeup_event(tty_port_tty_get(port)->dev, 0);
+ if (wake_active && irqd_is_wakeup_set(irq_get_irq_data(sport->port.irq))) {
+ struct tty_struct *tty = tty_port_tty_get(port);
+
+ if (tty) {
+ pm_wakeup_event(tty->dev, 0);
+ tty_kref_put(tty);
+ }
+ }
uart_port_unlock_irq(&sport->port);
}