[PATCH net-next v4 07/10] net: ntb_netdev: Reject short RX frames
From: Koichiro Den
Date: Mon Sep 14 2026 - 05:13:16 EST
ntb_netdev passes RX frames shorter than ETH_HLEN to eth_type_trans(),
which expects a complete Ethernet header.
Reject them as length errors.
Fixes: 548c237c0a99 ("net: Add support for NTB virtual ethernet device")
Signed-off-by: Koichiro Den <den@xxxxxxxxxxxxx>
---
Changes in v4:
- New patch. Included here to fix the existing RX length check before
adding checks for ntb_netdev_hdr later in the series.
drivers/net/ntb_netdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ntb_netdev.c b/drivers/net/ntb_netdev.c
index 78df47659d45..84fdd81ebd16 100644
--- a/drivers/net/ntb_netdev.c
+++ b/drivers/net/ntb_netdev.c
@@ -140,7 +140,7 @@ static void ntb_netdev_rx_handler(struct ntb_transport_qp *qp, void *qp_data,
netdev_dbg(ndev, "%s: %d byte payload received\n", __func__, len);
- if (len < 0) {
+ if (len < ETH_HLEN) {
DEV_STATS_INC(ndev, rx_errors);
DEV_STATS_INC(ndev, rx_length_errors);
goto enqueue_again;
--
2.51.0