summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorStefan Wahren <wahrenst@gmx.net>2024-11-08 12:43:43 +0100
committerJakub Kicinski <kuba@kernel.org>2024-11-09 22:41:17 +0100
commite68da664d379f352d41d7955712c44e0a738e4ab (patch)
treecb96242d0108bee569b746b9879f585f92c8af7c /drivers/net
parentsctp: fix possible UAF in sctp_v6_available() (diff)
downloadlinux-e68da664d379f352d41d7955712c44e0a738e4ab.tar.xz
linux-e68da664d379f352d41d7955712c44e0a738e4ab.zip
net: vertexcom: mse102x: Fix tx_bytes calculation
The tx_bytes should consider the actual size of the Ethernet frames without the SPI encapsulation. But we still need to take care of Ethernet padding. Fixes: 2f207cbf0dd4 ("net: vertexcom: Add MSE102x SPI support") Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Link: https://patch.msgid.link/20241108114343.6174-3-wahrenst@gmx.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/vertexcom/mse102x.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/ethernet/vertexcom/mse102x.c b/drivers/net/ethernet/vertexcom/mse102x.c
index 2c37957478fb..89dc4c401a8d 100644
--- a/drivers/net/ethernet/vertexcom/mse102x.c
+++ b/drivers/net/ethernet/vertexcom/mse102x.c
@@ -437,13 +437,15 @@ static void mse102x_tx_work(struct work_struct *work)
mse = &mses->mse102x;
while ((txb = skb_dequeue(&mse->txq))) {
+ unsigned int len = max_t(unsigned int, txb->len, ETH_ZLEN);
+
mutex_lock(&mses->lock);
ret = mse102x_tx_pkt_spi(mse, txb, work_timeout);
mutex_unlock(&mses->lock);
if (ret) {
mse->ndev->stats.tx_dropped++;
} else {
- mse->ndev->stats.tx_bytes += txb->len;
+ mse->ndev->stats.tx_bytes += len;
mse->ndev->stats.tx_packets++;
}