From: sashiko-bot@kernel.org
To: "Samarth Narang" <samarth.colleges@gmail.com>
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH 4/5] tty: serial: msm: fix TX kfifo underflow on flush
Date: Sat, 31 Oct 2026 12:55:18 +0000 [thread overview]
Message-ID: <sashiko-outbox-191949@kernel.org> (raw)
In-Reply-To: <20261031123911.3784690-5-samarth.colleges@gmail.com>
> uart_flush_buffer() resets the transmit kfifo under the port lock before
> calling the driver's flush_buffer() hook. Since msm_serial does not
> implement this hook, an outstanding TX DMA transfer may complete after
> the flush and call uart_xmit_advance() using the flushed transfer's byte
> count. The existing check for a stopped transfer relies on tx_sg, which
> the flush does not clear, so it does not catch this case. The kfifo tail
> then advances past its head, causing kfifo_len() to wrap and the driver
> to transmit stale buffer contents. The same issue was fixed in 8250 by
> commit 9e512eaaf8f4 ("serial: 8250: Fix fifo underflow on flush").
>
> Since the TX buffer is mapped separately for each transfer and the flush
> hook runs under the port lock, the driver cannot synchronously terminate
> DMA and safely unmap the buffer from that context. Instead, leave the
> outstanding transfer running and mark it as flushed, allowing the
> completion callback to unmap the buffer without advancing the kfifo.
> Clear the flag when preparing the next transfer. This avoids the kfifo
> underflow, although the data already queued for DMA before the flush may
> still be transmitted.
>
> Fixes: 3a878c430fd6 ("tty: serial: msm: Add TX DMA support")
> Cc: stable@vger.kernel.org
> Assisted-by: LLM
> Signed-off-by: Samarth Narang <samarth.colleges@gmail.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261031123911.3784690-1-samarth.colleges@gmail.com?part=4
next prev parent reply other threads:[~2026-10-31 12:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-31 0:47 [BUG] serial: TX kfifo underflow when TCOFLUSH races with TX DMA (samsung, sprd, msm, pch_uart, tegra) Samarth Narang
2026-10-31 8:54 ` Greg Kroah-Hartman
2026-10-31 12:39 ` [PATCH 0/5] serial: fix TX kfifo underflow on flush in five drivers Samarth Narang
2026-10-31 12:39 ` [PATCH 1/5] tty: serial: samsung: fix TX kfifo underflow on flush Samarth Narang
2026-10-31 12:39 ` [PATCH 2/5] serial: tegra: don't advance the TX kfifo for a flushed transfer Samarth Narang
2026-10-31 12:55 ` sashiko-bot
2026-10-31 12:39 ` [PATCH 3/5] serial: sprd: fix TX kfifo underflow on flush Samarth Narang
2026-10-31 12:39 ` [PATCH 4/5] tty: serial: msm: " Samarth Narang
2026-10-31 12:55 ` sashiko-bot [this message]
2026-10-31 12:39 ` [PATCH 5/5] serial: pch_uart: " Samarth Narang
2026-10-31 12:55 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-191949@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=samarth.colleges@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.