From: sashiko-bot@kernel.org
To: "Tapio Reijonen" <tapio.reijonen@vaisala.com>
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH v2 1/4] serial: max310x: do not advance the TX fifo past a flush
Date: Tue, 17 Nov 2026 06:31:19 +0000 [thread overview]
Message-ID: <sashiko-outbox-218257@kernel.org> (raw)
In-Reply-To: <20261117-max310x-tx-fixes-v2-1-b395126fd23d@vaisala.com>
> max310x_handle_tx() runs from a work item. It peeks at the transmit
> fifo with kfifo_out_linear_ptr(), writes the bytes to the chip over
> SPI, which sleeps, and advances the fifo afterwards with
> uart_xmit_advance(), all without the port lock. uart_flush_buffer()
> resets the fifo under the port lock. When the reset lands between the
> peek and the advance, the advance adds the chunk length to a read
> index that is already zero, the index ends up ahead of the write
> index, and kfifo_len() wraps to a value near 4G.
>
> From then on the fifo never reads as empty: tcdrain() sleeps forever
> in tty_wait_until_sent(), and while the port stays open the work item
> keeps sending stale bytes from the buffer. Observed with a tcdrain()
> in flight at 300 baud when the port was hung up by an unbind, which
> flushes twice: the first flush left 498 bytes, the second found
> 4294967217, the draining task read 4294967276 and never woke again.
> [ ... ]
> and from a FIFO level read from the chip.
>
> Fixes: 1788cf6a91d9 ("tty: serial: switch from circ_buf to kfifo")
> Cc: stable@vger.kernel.org
> Signed-off-by: Tapio Reijonen <tapio.reijonen@vaisala.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261117-max310x-tx-fixes-v2-0-b395126fd23d@vaisala.com?part=1
next prev parent reply other threads:[~2026-11-17 6:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 6:14 [PATCH v2 0/4] serial: max310x: transmit path fixes Tapio Reijonen
2026-11-17 6:14 ` [PATCH v2 1/4] serial: max310x: do not advance the TX fifo past a flush Tapio Reijonen
2026-11-17 6:31 ` sashiko-bot [this message]
2026-11-17 6:14 ` [PATCH v2 2/4] serial: max310x: re-check the TX queue before the after-send hold Tapio Reijonen
2026-11-17 6:21 ` sashiko-bot
2026-11-17 6:14 ` [PATCH v2 3/4] serial: max310x: hold TX data until the software RTS send phase Tapio Reijonen
2026-11-17 6:48 ` sashiko-bot
2026-11-17 6:14 ` [PATCH v2 4/4] serial: max310x: end the RTS envelope when a flush leaves nothing to send Tapio Reijonen
2026-11-17 6:22 ` 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-218257@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tapio.reijonen@vaisala.com \
/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.