From 02ea839838d49cc41b7cfb627e8c11013be90d88 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Tue, 5 May 2026 14:43:12 +0200 Subject: [PATCH] net_util: queue_pair: Handle TX short tap write gracefully When writev returns fewer bytes than vnet_hdr_len the packet is truncated. Log the error and drop it instead of returning a fatal InvalidVirtioNetHeader error that would crash the worker thread. Signed-off-by: Anatol Belski --- net_util/src/queue_pair.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net_util/src/queue_pair.rs b/net_util/src/queue_pair.rs index e7028b2f9..6bce145f9 100644 --- a/net_util/src/queue_pair.rs +++ b/net_util/src/queue_pair.rs @@ -127,7 +127,8 @@ impl TxVirtio { return Err(NetQueuePairError::WriteTap(e)); } } else if (result as usize) < vnet_hdr_len() { - return Err(NetQueuePairError::InvalidVirtioNetHeader); + error!("net: tx: short tap write ({result} < {})", vnet_hdr_len()); + 0 } else { self.counter_bytes += Wrapping(result as u64 - vnet_hdr_len() as u64); self.counter_frames += Wrapping(1);