Skip to contentSkip to conversation

net: qualcomm: qca_uart: report the consumed byte on RX skb allocation failure

PATCH Applied Pengpeng Hou 4 participants 4 messages Apr 2 – Apr 3

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: qualcomm: qca_uart: report the consumed byte on RX skb allocation failure

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")
---
 drivers/net/ethernet/qualcomm/qca_uart.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/qualcomm/qca_uart.c +1 -1
index 37efb1ea9fcd..847a5f928e41 100644
@@ -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;
 			}
 		}
 	}
Signature · 1 line
2.50.1 (Apple Git-155)
maintainer Reviewed-by on v1 1/1
#1 lore raw

Am 02.04.26 um 09:12 schrieb Pengpeng Hou:

Quoted 11 lines

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.

Quoted 6 lines

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")

Thanks

reviewer Reviewed-by on v1 1/1
#2 lore raw
In reply to Pengpeng Hou
Quoted 11 lines · 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.

Quoted 6 lines

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")
#3 lore raw
In reply to Pengpeng Hou
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 5 lines · 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.

Quoted 7 lines

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!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html