Linux Serial subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Cheng Yongkang" <teel4res@gmail.com>
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH] tty: n_hdlc: fix duplicated prefix on partial writes
Date: Thu, 29 Oct 2026 14:23:37 +0000	[thread overview]
Message-ID: <sashiko-outbox-189507@kernel.org> (raw)
In-Reply-To: <179328314077.648427.13745367584859897488@gmail.com>

> n_hdlc_send_frames() passes the whole queued frame to tty->ops->write().
> When the driver accepts only a prefix and returns a positive short count,
> the current code puts the whole buffer back at the head of tx_buf_list
> without adjusting its length.  The wakeup callback later sends the frame
> again from byte 0, so the prefix already committed to the peer's flip
> buffer is transmitted twice:
> 
>   DUPLICATED PREFIX: magic occurrence 5 at offset 19968, frame index 4
>   drained 36864 bytes, target 28672
> 
> n_hdlc_tty_write() still returns the full count because the ldisc owns
> the queued frame; the short write is an internal transport event.  Drop
> the written prefix from the buffer and requeue only the remaining bytes,
> so the next wakeup continues where the driver stopped.  Full writes, the
> -ERESTARTSYS rollback, other errors, and a zero-byte write keep their
> existing behavior.  Clamp a driver report larger than the frame to the
> frame length.
> 
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Cc: stable@vger.kernel.org
> Assisted-by: LLM
> Signed-off-by: Cheng Yongkang <teel4res@gmail.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/179328314077.648427.13745367584859897488@gmail.com?part=1


      reply	other threads:[~2026-10-29 14:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29 14:12 [PATCH] tty: n_hdlc: fix duplicated prefix on partial writes Cheng Yongkang
2026-10-29 14:23 ` 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-189507@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=teel4res@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox