]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: qualcomm: qca_uart: report the consumed byte on RX skb allocation failure
authorPengpeng Hou <pengpeng@iscas.ac.cn>
Thu, 2 Apr 2026 07:12:07 +0000 (15:12 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 18 Apr 2026 08:33:37 +0000 (10:33 +0200)
commit b76254c55dc8f23edc089027dd3f8792554c69fb upstream.

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>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260402071207.4036-1-pengpeng@iscas.ac.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/qualcomm/qca_uart.c

index 27c4f43176aaaf8ac43a73c62a56c44bced730bb..c7af9a1b6fdd81ad1298f2c55c06209d1c2e1030 100644 (file)
@@ -115,7 +115,7 @@ qca_tty_receive(struct serdev_device *serdev, const unsigned char *data,
                        if (!qca->rx_skb) {
                                netdev_dbg(netdev, "recv: out of RX resources\n");
                                n_stats->rx_errors++;
-                               return i;
+                               return i + 1;
                        }
                }
        }