All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tim Douglas" <me@timdoug.com>
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH 2/2] serial: pmac_zilog: report received breaks
Date: Tue, 13 Oct 2026 01:44:13 +0000	[thread overview]
Message-ID: <sashiko-outbox-168837@kernel.org> (raw)
In-Reply-To: <20261013013541.4535-3-me@timdoug.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] tty: serial: false break injection on NUL after Rx overrun
--

commit 009d6cf5b2db60250bcc44251e6de09814cc2746
Author: Tim Douglas <me@timdoug.com>

serial: pmac_zilog: report received breaks

This commit modifies pmz_receive_chars() to set the BRK_ABRT flag in r1
when processing the null character that ends a break. This allows breaks
to be properly counted and passed to BRKINT, PARMRK, and SysRq handlers,
matching the behavior of sunzilog.

> diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c
> index f49d6052d11be..a612f1db9f189 100644
> --- a/drivers/tty/serial/pmac_zilog.c
> +++ b/drivers/tty/serial/pmac_zilog.c
> @@ -233,6 +233,7 @@ static bool pmz_receive_chars(struct uart_pmac_port *uap)
>  		ch &= uap->parity_mask;
>  		if (ch == 0 && uap->flags & PMACZILOG_FLAG_BREAK) {
>  			uap->flags &= ~PMACZILOG_FLAG_BREAK;
> +			r1 |= BRK_ABRT;
>  		}

[Severity: Medium]
Does this code risk injecting a false Break event if an Rx FIFO overrun
occurs?

pmz_status_handle() sets PMACZILOG_FLAG_BREAK when it receives an EXT status
interrupt for a Break. Then pmz_receive_chars() waits for the associated NUL
character to clear the flag.

If an Rx FIFO overrun occurs and the hardware drops the expected NUL character,
the PMACZILOG_FLAG_BREAK flag will remain set indefinitely.

Since BRK_ABRT is now artificially injected into r1 when this flag is finally
cleared, could a subsequent, perfectly valid NUL character (such as Ctrl-@)
arriving much later falsely trigger a Break?

This might cause dropped data or trigger an unintended SysRq. Before this patch,
the stuck flag was harmless because it was cleared without altering r1.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261013013541.4535-1-me@timdoug.com?part=2

      reply	other threads:[~2026-10-13  1:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13  1:35 [PATCH 0/2] serial: pmac_zilog: two receive fixes Tim Douglas
2026-10-13  1:35 ` [PATCH 1/2] serial: pmac_zilog: push received data to the port that received it Tim Douglas
2026-10-13  1:48   ` sashiko-bot
2026-10-13  1:35 ` [PATCH 2/2] serial: pmac_zilog: report received breaks Tim Douglas
2026-10-13  1:44   ` sashiko-bot [this message]

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-168837@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=me@timdoug.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.