From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=182.48.54.220 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796183421; b=K9cIeH2MCRdhB3MSm8GXC6xceFeO9n2/RzqEeFGPFbMdW70qMqtYqfO9C7bJrRw0bbZH W7B4yPTcI/+FWMH56M7JjRaFtYXI5Y9bmr2yddRCSJrrmVIpA6U0cIUR3XF5SsdAbJFNI B7RtVbP251Ltnd1XQ4gTo3qVO7E5OcrT4bUBrcGbnAqyNWmF9ys1bwSHX5sng9RSRmhgR pbItu3mG4akkftwOLwh/TtHLXVlDW1s1iK98npQcdaarV+NVR9fr1fZ/vSrScjSWEa4Bp HD6bU/UvUWMYocAdsxdHIhGrdzQXL6eN7yoqN/+6ov+39S8dgkPwLV/DNEvs+KOxIfw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796183421; h=DMARC-Filter:Received:From:To:Cc:Subject:Date:Message-ID:In-Reply-To: References:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=OebQI00VLQwspMOJ3/fNFG3sgudHARpMprpAD9OCkeY=; b=skF5LR4vuGsmu+5XymEHHR4M0HRhph6q3wKE8qLgv2/Tkhv+7heN6/TW3xXRC/ydyab+ rr7ehpZAe4qGZCaWwqDYYQONn6JDoOw2tikNzvxzbao7MQBES3Raa9iAiAmxN8HTgcgAR /FaZ5dfvZ93Cp8zXvsFY1U+cKTW4AS98r+0w6G2pWTcMDfIwfpPTF7ErVLW2CxWPfQvKx DCeihLElnp92zEeJ/16EgcYtlyEDFxdW6zOrTsvH6qKc3i07BeVRXJa97IeAAqGrTf3Po KGB5nnOlXyuWnY/zN/a7Nots1ArpbSjjcWuBsDrL239AtELomWOBg/DWzrP+hSRR3oA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=snowrabbit.org; spf=pass smtp.mailfrom=snowrabbit.org; arc=none smtp.remote-ip=182.48.54.220 Received: from bambi.snowrabbit.org (bambi.snowrabbit.org [182.48.54.220]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9DB8E606A33A; Wed, 2 Dec 2026 03:50:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9DB8E606A33A Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=snowrabbit.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=snowrabbit.org Received: by bambi.snowrabbit.org (Postfix, from userid 3001) id 8398AC92FC; Wed, 2 Dec 2026 12:50:18 +0900 (JST) From: Showta Ishizaki To: "Michael S. Tsirkin" , Willem de Bruijn , Jason Wang , netdev@vger.kernel.org Cc: Eric Dumazet , Jakub Kicinski , Paolo Abeni , "David S. Miller" , Andrew Lunn , Simon Horman , =?utf-8?q?Eugenio_P=C3=A9rez?= , Xuan Zhuo , Richard Weinberger , Anton Ivanov , Johannes Berg , Jonathan Corbet , Shuah Khan , Randy Dunlap , Chris Arges , Paulos Yibelo , =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , virtualization@lists.linux.dev, linux-um@lists.infradead.org, linux-doc@vger.kernel.org, Showta Ishizaki Subject: [PATCH RFC net v9 2/6] um: vector: trim skbs before verifying the header Date: Wed, 02 Dec 2026 13:00:00 +0900 Message-ID: <20261202.rfcv9.41657.2.zakinko@snowrabbit.org> In-Reply-To: <20261202.rfcv9.41657.0.zakinko@snowrabbit.org> References: <20261202.rfcv9.41657.0.zakinko@snowrabbit.org> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: "Michael S. Tsirkin" The vector receive path over-allocates the skb and only trims it to the received length after the transport header is verified. A follow up patch will complete the packet checksum in software within virtio_net_hdr_to_skb so we need the packet trimmed (otherwise the checksum would be computed incorrectly over the unreceived tail of the buffer). Trim first, so the import sees the packet as it was received. Reviewed-by: Willem de Bruijn Signed-off-by: Michael S. Tsirkin Signed-off-by: Showta Ishizaki --- arch/um/drivers/vector_kern.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c index e902e78c5ff6..828bd61995b8 100644 --- a/arch/um/drivers/vector_kern.c +++ b/arch/um/drivers/vector_kern.c @@ -873,6 +873,7 @@ static int vector_legacy_rx(struct vector_private *vp) if (skb != NULL) { if (pkt_len > vp->header_size) { + pskb_trim(skb, pkt_len - vp->rx_header_size); if (vp->header_size > 0) { header_check = vp->verify_header( vp->header_rxbuffer, skb, vp); @@ -887,7 +888,6 @@ static int vector_legacy_rx(struct vector_private *vp) skb->ip_summed = CHECKSUM_UNNECESSARY; } } - pskb_trim(skb, pkt_len - vp->rx_header_size); skb->protocol = eth_type_trans(skb, skb->dev); vp->dev->stats.rx_bytes += skb->len; vp->dev->stats.rx_packets++; @@ -989,6 +989,8 @@ static int vector_mmsg_rx(struct vector_private *vp, int budget) for (i = 0; i < packet_count; i++) { skb = (*skbuff_vector); if (mmsg_vector->msg_len > vp->header_size) { + pskb_trim(skb, + mmsg_vector->msg_len - vp->rx_header_size); if (vp->header_size > 0) { header_check = vp->verify_header( mmsg_vector->msg_hdr.msg_iov->iov_base, @@ -1013,8 +1015,6 @@ static int vector_mmsg_rx(struct vector_private *vp, int budget) skb->ip_summed = CHECKSUM_UNNECESSARY; } } - pskb_trim(skb, - mmsg_vector->msg_len - vp->rx_header_size); skb->protocol = eth_type_trans(skb, skb->dev); /* * We do not need to lock on updating stats here -- 2.54.0 (Apple Git-157)