* FAILED: patch "[PATCH] serial: samsung: don't leak the tty on an RX IRQ" failed to apply to 5.10-stable tree
@ 2026-11-25 11:32 gregkh
2026-11-26 15:10 ` [PATCH 5.10.y] serial: samsung: don't leak the tty on an RX IRQ Sasha Levin
0 siblings, 1 reply; 2+ messages in thread
From: gregkh @ 2026-11-25 11:32 UTC (permalink / raw)
To: josef, alim.akhtar, gregkh, jirislaby, krzk, peter.griffin,
r.baldyga, stable
Cc: stable
The patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x 7ada442f5ef77f8d53f608a0141a5e88a888ca9f
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2026112552-acre-justifier-533d@gregkh' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 7ada442f5ef77f8d53f608a0141a5e88a888ca9f Mon Sep 17 00:00:00 2001
From: Josef Bacik <josef@toxicpanda.com>
Date: Tue, 27 Oct 2026 12:06:47 +0100
Subject: [PATCH] serial: samsung: don't leak the tty on an RX IRQ
s3c24xx_serial_rx_chars_dma() starts by taking a reference to the tty.
If the interrupt is not a receive timeout, it switches the port from PIO
back to DMA and leaves through the "finish" label, which does not drop
the reference.
A port with RX DMA changes to PIO on every receive timeout, that is at
the end of every burst of data, and comes back this way when the next
burst starts. So each burst takes a reference which is never dropped,
and the tty structure is not freed when the port is closed for the last
time.
Drop the reference on both paths.
Fixes: b543c301c2c5 ("serial: samsung: add DMA support for RX")
Cc: stable <stable@kernel.org>
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Peter Griffin <peter.griffin@linaro.org>
Cc: Alim Akhtar <alim.akhtar@samsung.com>
Cc: Jiri Slaby <jirislaby@kernel.org>
Cc: Robert Baldyga <r.baldyga@samsung.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-21-99b0202ae546@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c
index 640f85e2d636..c9a870a8d155 100644
--- a/drivers/tty/serial/samsung_tty.c
+++ b/drivers/tty/serial/samsung_tty.c
@@ -736,14 +736,13 @@ static irqreturn_t s3c24xx_serial_rx_chars_dma(struct s3c24xx_uart_port *ourport
s3c24xx_serial_rx_drain_fifo(ourport);
- if (tty) {
+ if (tty)
tty_flip_buffer_push(t);
- tty_kref_put(tty);
- }
wr_regl(port, S3C2410_UTRSTAT, S3C2410_UTRSTAT_TIMEOUT);
finish:
+ tty_kref_put(tty);
uart_port_unlock(port);
return IRQ_HANDLED;
^ permalink raw reply related [flat|nested] 2+ messages in thread* [PATCH 5.10.y] serial: samsung: don't leak the tty on an RX IRQ
2026-11-25 11:32 FAILED: patch "[PATCH] serial: samsung: don't leak the tty on an RX IRQ" failed to apply to 5.10-stable tree gregkh
@ 2026-11-26 15:10 ` Sasha Levin
0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2026-11-26 15:10 UTC (permalink / raw)
To: stable
Cc: Josef Bacik, stable, Krzysztof Kozlowski, Peter Griffin,
Alim Akhtar, Jiri Slaby, Robert Baldyga, Greg Kroah-Hartman,
Sasha Levin
From: Josef Bacik <josef@toxicpanda.com>
[ Upstream commit 7ada442f5ef77f8d53f608a0141a5e88a888ca9f ]
s3c24xx_serial_rx_chars_dma() starts by taking a reference to the tty.
If the interrupt is not a receive timeout, it switches the port from PIO
back to DMA and leaves through the "finish" label, which does not drop
the reference.
A port with RX DMA changes to PIO on every receive timeout, that is at
the end of every burst of data, and comes back this way when the next
burst starts. So each burst takes a reference which is never dropped,
and the tty structure is not freed when the port is closed for the last
time.
Drop the reference on both paths.
Fixes: b543c301c2c5 ("serial: samsung: add DMA support for RX")
Cc: stable <stable@kernel.org>
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Peter Griffin <peter.griffin@linaro.org>
Cc: Alim Akhtar <alim.akhtar@samsung.com>
Cc: Jiri Slaby <jirislaby@kernel.org>
Cc: Robert Baldyga <r.baldyga@samsung.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-21-99b0202ae546@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ sashal: Moved the tty_kref_put() to the finish: label, keeping this tree's uart_port_unlock_irqrestore(port, flags) in place of the upstream uart_port_unlock(port) context line. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/tty/serial/samsung_tty.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c
index 09dc73654ae3f..9222e1a1a7c8e 100644
--- a/drivers/tty/serial/samsung_tty.c
+++ b/drivers/tty/serial/samsung_tty.c
@@ -693,14 +693,13 @@ static irqreturn_t s3c24xx_serial_rx_chars_dma(void *dev_id)
s3c24xx_serial_rx_drain_fifo(ourport);
- if (tty) {
+ if (tty)
tty_flip_buffer_push(t);
- tty_kref_put(tty);
- }
wr_regl(port, S3C2410_UTRSTAT, S3C2410_UTRSTAT_TIMEOUT);
finish:
+ tty_kref_put(tty);
uart_port_unlock_irqrestore(port, flags);
return IRQ_HANDLED;
--
2.53.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-26 15:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25 11:32 FAILED: patch "[PATCH] serial: samsung: don't leak the tty on an RX IRQ" failed to apply to 5.10-stable tree gregkh
2026-11-26 15:10 ` [PATCH 5.10.y] serial: samsung: don't leak the tty on an RX IRQ Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox