public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: qualcomm: qca_uart: report the consumed byte on RX skb allocation failure
@ 2026-04-02  7:12 Pengpeng Hou
  2026-04-02  9:05 ` Stefan Wahren
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Pengpeng Hou @ 2026-04-02  7:12 UTC (permalink / raw)
  To: Stefan Wahren, Andrew Lunn, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-kernel, pengpeng, stable

qca_tty_receive() consumes each input byte before checking whether a
completed frame needs a fresh receive skb. When the current byte completes
a frame, the driver delivers that frame and then allocates a new skb for
the next one.

If that allocation fails, the current code returns i even though data[i]
has already been consumed and may already have completed the delivered
frame. Since serdev interprets the return value as the number of accepted
bytes, this under-reports progress by one byte and can replay the final
byte of the completed frame into a fresh parser state on the next call.

Return i + 1 in that failure path so the accepted-byte count matches the
actual receive-state progress.

Fixes: dfc768fbe618 ("net: qualcomm: add QCA7000 UART driver")
Cc: stable@vger.kernel.org
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
 drivers/net/ethernet/qualcomm/qca_uart.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qualcomm/qca_uart.c b/drivers/net/ethernet/qualcomm/qca_uart.c
index 37efb1ea9fcd..847a5f928e41 100644
--- a/drivers/net/ethernet/qualcomm/qca_uart.c
+++ b/drivers/net/ethernet/qualcomm/qca_uart.c
@@ -100,7 +100,7 @@ qca_tty_receive(struct serdev_device *serdev, const u8 *data, size_t count)
 			if (!qca->rx_skb) {
 				netdev_dbg(netdev, "recv: out of RX resources\n");
 				n_stats->rx_errors++;
-				return i;
+				return i + 1;
 			}
 		}
 	}
-- 
2.50.1 (Apple Git-155)


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: qualcomm: qca_uart: report the consumed byte on RX skb allocation failure
  2026-04-02  7:12 [PATCH] net: qualcomm: qca_uart: report the consumed byte on RX skb allocation failure Pengpeng Hou
@ 2026-04-02  9:05 ` Stefan Wahren
  2026-04-03 15:37 ` Simon Horman
  2026-04-03 22:40 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Wahren @ 2026-04-02  9:05 UTC (permalink / raw)
  To: Pengpeng Hou, Andrew Lunn, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-kernel, stable

Am 02.04.26 um 09:12 schrieb Pengpeng Hou:
> qca_tty_receive() consumes each input byte before checking whether a
> completed frame needs a fresh receive skb. When the current byte completes
> a frame, the driver delivers that frame and then allocates a new skb for
> the next one.
>
> If that allocation fails, the current code returns i even though data[i]
> has already been consumed and may already have completed the delivered
> frame. Since serdev interprets the return value as the number of accepted
> bytes, this under-reports progress by one byte and can replay the final
> byte of the completed frame into a fresh parser state on the next call.
>
> Return i + 1 in that failure path so the accepted-byte count matches the
> actual receive-state progress.
>
> Fixes: dfc768fbe618 ("net: qualcomm: add QCA7000 UART driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Reviewed-by: Stefan Wahren <wahrenst@gmx.net>

Thanks


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: qualcomm: qca_uart: report the consumed byte on RX skb allocation failure
  2026-04-02  7:12 [PATCH] net: qualcomm: qca_uart: report the consumed byte on RX skb allocation failure Pengpeng Hou
  2026-04-02  9:05 ` Stefan Wahren
@ 2026-04-03 15:37 ` Simon Horman
  2026-04-03 22:40 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2026-04-03 15:37 UTC (permalink / raw)
  To: Pengpeng Hou
  Cc: Stefan Wahren, Andrew Lunn, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev, linux-kernel, stable

On Thu, Apr 02, 2026 at 03:12:07PM +0800, Pengpeng Hou wrote:
> qca_tty_receive() consumes each input byte before checking whether a
> completed frame needs a fresh receive skb. When the current byte completes
> a frame, the driver delivers that frame and then allocates a new skb for
> the next one.
> 
> If that allocation fails, the current code returns i even though data[i]
> has already been consumed and may already have completed the delivered
> frame. Since serdev interprets the return value as the number of accepted
> bytes, this under-reports progress by one byte and can replay the final
> byte of the completed frame into a fresh parser state on the next call.
> 
> Return i + 1 in that failure path so the accepted-byte count matches the
> actual receive-state progress.
> 
> Fixes: dfc768fbe618 ("net: qualcomm: add QCA7000 UART driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: qualcomm: qca_uart: report the consumed byte on RX skb allocation failure
  2026-04-02  7:12 [PATCH] net: qualcomm: qca_uart: report the consumed byte on RX skb allocation failure Pengpeng Hou
  2026-04-02  9:05 ` Stefan Wahren
  2026-04-03 15:37 ` Simon Horman
@ 2026-04-03 22:40 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-04-03 22:40 UTC (permalink / raw)
  To: Pengpeng Hou
  Cc: wahrenst, andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel, stable

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu,  2 Apr 2026 15:12:07 +0800 you wrote:
> qca_tty_receive() consumes each input byte before checking whether a
> completed frame needs a fresh receive skb. When the current byte completes
> a frame, the driver delivers that frame and then allocates a new skb for
> the next one.
> 
> If that allocation fails, the current code returns i even though data[i]
> has already been consumed and may already have completed the delivered
> frame. Since serdev interprets the return value as the number of accepted
> bytes, this under-reports progress by one byte and can replay the final
> byte of the completed frame into a fresh parser state on the next call.
> 
> [...]

Here is the summary with links:
  - net: qualcomm: qca_uart: report the consumed byte on RX skb allocation failure
    https://git.kernel.org/netdev/net/c/b76254c55dc8

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-04-03 22:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-02  7:12 [PATCH] net: qualcomm: qca_uart: report the consumed byte on RX skb allocation failure Pengpeng Hou
2026-04-02  9:05 ` Stefan Wahren
2026-04-03 15:37 ` Simon Horman
2026-04-03 22:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox