From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f46.google.com (mail-qv1-f46.google.com [209.85.219.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 86EFF33F37A for ; Fri, 8 May 2026 22:22:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778278967; cv=none; b=UC4jpBwL02tAQL6jeEcj6L2/AFtwsrxJe0OQaQhfOoOkhB/IE72fW423PfrFOx15CahgNSm53gjgyGQb8sBzuIWJOTPTIKndzmZ/McWPwwLFVUqgF6u8WzlYtBnldvWwId1284mUDWIhvs12Xlv9A1VJSzu3BlUvLhFCxCsOPig= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778278967; c=relaxed/simple; bh=ybo2HK/PI6PDF5GbqOTLQGuk0Dq2WjaK+tSFJS3Pp9Y=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=C9EuUrYS3PlJLEbUqs/h/6UfKTyzGDU2zXxGKWKV+3l2+nMuq1m9gBeiFZcd+0wkzf6T4l1QAdDK0EPQt7+KY1qr8BMl/gdibeNtr9lsBXoOnyvtTGaER+N4fbNuojdBdCuv9dCS6nVZjcQJpLJIBR3mp3kPqDhd8E881vPV6tk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=cuizcXye; arc=none smtp.client-ip=209.85.219.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cuizcXye" Received: by mail-qv1-f46.google.com with SMTP id 6a1803df08f44-8b5232009a6so23693846d6.1 for ; Fri, 08 May 2026 15:22:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778278962; x=1778883762; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=5MQa0UpWFwjb5S8kUnJztiH2lQyqJ0Jvx1ScOQZwHKA=; b=cuizcXyeDI2zPjB6uL1F5Lldbr9PBBUQtUKz/vc8IV0wN7ZABZ0g36M3xkjq5XQyNU w4rBEKFc/VTtOKe6DburFSrQicZX8quIPqnLa+nGjwukyUXGHV2rjQjf4hLVV35sNsEF vmrpXzQzv40NgqcGmFAY4CUcqVMuwyJMUYvgJmJAyCKt0+3oVmoUGmUGeD5FLv9V/WUO I9D2t5eUYDIUMOJ/+dokux8av2rVGvRb87WMJ/CorZLmXvMEmAwaS5hTuOi3VDMVrJLD zvtRdRw9UHZUv/pghA/f+vCVNnbSBWJK2Xb83dBvkoJvsMZTb145g8hNPiIZOOWzY7s0 2wsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778278962; x=1778883762; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5MQa0UpWFwjb5S8kUnJztiH2lQyqJ0Jvx1ScOQZwHKA=; b=oB77XD1Kz1KeVzPloGzFFstg+dZvsLNtovIjRD5tRVekodJgr6nJwgpbs4/lpgSwe6 hHsLeFICmMzSFiEHlbXfA5ioNqJrAxAdNIIQk7ox5kdU5u90+0KNcBHpzUGP4odkd06I d6NkXnSsv8XDMvd4xg0MDK1h/F2F4f3N0nBPNFzxPFNMV8kI2BK4W2ihqOM8w3tbLTcv F4N+SoP820jNDIRiwH0+6utkaKBJLa6ZusK4sOZE0k/s3HwIgEmetnfeCj2I4YpTqUdN RqLHOQl/8BVmk//0vPHxGksuzOETUAwEnaiQPu2p4hUKv+1rtW/EI94xcGbpDCM8Jb3T 2/nA== X-Forwarded-Encrypted: i=1; AFNElJ9jMTDVNG+kkZxHuXhahq3Fns+HaAxd3zEK8Lg6cebcBBicwq/Xirf0V2JKfPMkeO7a4znrpKa4KLcDCyw=@vger.kernel.org X-Gm-Message-State: AOJu0YxwipEwSyIgJ70qxfxMyCS1KG+iSU0ok0Inv1KLMAkXTcSci7fY 1wVAvcR5Pda5PIKR8rl2uN7PGpjO5ZzxjcQm+hV0HMRU3i2IwKP3VleJ X-Gm-Gg: Acq92OFsceLVzz/L8CxTShI10PGd8tNdpcFx44IQlvyLoGVohUnEqeYTmy+9xjUwAGx bzUp1m1bRE3mm1punFpfDhXw0Ar/VMuvFoqyRl9RuqRIoQficOd9v96NIfuRRvOqPzDIMp9HFX1 /HrMguWUJ7mVi/SUJDp4YASq6aqz3sB7XZdhgimZBflkQGHMJwtGPZuI086kc365UIUd/iSChUr 45fX2kU5KQfCY7cuSwMVewpDRXhQTeRr5U1MaTCFZjUAH0C8Plfbid/EIZ7HCS1eGvFTUDf6KMz p7748Uvxj1irxl1EdooBaXplQWNfGyqbE+Fj4TI8+9iI2x5qDLkKyFUsAJH+p7YsyfssXNaH1jK go2oO2tngBrXpale0Vw2P8n+Hv7dI2XGQ5MfMXaN2WbasqAu5fsG0JeJFGHDczYyOFdh/Q9rM8s LSxB5LAOd95lSCx1TjdkrLIx8Fxq7oTD1wAMP7Vdn1DF5KawRAMHC6zUo= X-Received: by 2002:a05:6214:258c:b0:8b0:2ae4:da26 with SMTP id 6a1803df08f44-8bc422a66f5mr208086466d6.10.1778278962004; Fri, 08 May 2026 15:22:42 -0700 (PDT) Received: from devvm29614.prn0.facebook.com ([2a03:2880:ff:72::]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8bf39c81b3fsm30363126d6.29.2026.05.08.15.22.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2026 15:22:41 -0700 (PDT) Date: Fri, 8 May 2026 15:22:37 -0700 From: Bobby Eshleman To: Stefano Garzarella Cc: netdev@vger.kernel.org, Yiqi Sun , linux-kernel@vger.kernel.org, Xuan Zhuo , "Michael S. Tsirkin" , Stefan Hajnoczi , kvm@vger.kernel.org, Simon Horman , Bobby Eshleman , Jason Wang , Jakub Kicinski , "David S. Miller" , virtualization@lists.linux.dev, Eric Dumazet , Paolo Abeni , Arseniy Krasnov , Eugenio =?iso-8859-1?Q?P=E9rez?= , Bobby Eshleman Subject: Re: [PATCH net 1/2] vsock/virtio: fix length and offset in tap skb for split packets Message-ID: References: <20260508164411.261440-1-sgarzare@redhat.com> <20260508164411.261440-2-sgarzare@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260508164411.261440-2-sgarzare@redhat.com> On Fri, May 08, 2026 at 06:44:10PM +0200, Stefano Garzarella wrote: > From: Stefano Garzarella > > virtio_transport_build_skb() builds a new skb to be delivered to the > vsockmon tap device. To build the new skb, it uses the original skb > data length as payload length, but as the comment notes, the original > packet stored in the skb may have been split in multiple packets, so we > need to use the length in the header, which is correctly updated before > the packet is delivered to the tap, and the offset for the data. > > This was also similar to what we did before commit 71dc9ec9ac7d > ("virtio/vsock: replace virtio_vsock_pkt with sk_buff") where we probably > missed something during the skb conversion. > > Also update the comment above, which was left stale by the skb > conversion and still mentioned a buffer pointer that no longer exists. > > Fixes: 71dc9ec9ac7d ("virtio/vsock: replace virtio_vsock_pkt with sk_buff") > Signed-off-by: Stefano Garzarella > --- > net/vmw_vsock/virtio_transport_common.c | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > > diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c > index 9b8014516f4f..a678d5d75704 100644 > --- a/net/vmw_vsock/virtio_transport_common.c > +++ b/net/vmw_vsock/virtio_transport_common.c > @@ -166,12 +166,12 @@ static struct sk_buff *virtio_transport_build_skb(void *opaque) > struct sk_buff *skb; > size_t payload_len; > > - /* A packet could be split to fit the RX buffer, so we can retrieve > - * the payload length from the header and the buffer pointer taking > - * care of the offset in the original packet. > + /* A packet could be split to fit the RX buffer, so we use > + * the payload length from the header, which has been updated > + * by the sender to reflect the fragment size. > */ > pkt_hdr = virtio_vsock_hdr(pkt); > - payload_len = pkt->len; > + payload_len = le32_to_cpu(pkt_hdr->len); > > skb = alloc_skb(sizeof(*hdr) + sizeof(*pkt_hdr) + payload_len, > GFP_ATOMIC); > @@ -219,7 +219,8 @@ static struct sk_buff *virtio_transport_build_skb(void *opaque) > > virtio_transport_copy_nonlinear_skb(pkt, data, payload_len); > } else { > - skb_put_data(skb, pkt->data, payload_len); > + skb_put_data(skb, pkt->data + VIRTIO_VSOCK_SKB_CB(pkt)->offset, > + payload_len); > } > } > > -- > 2.54.0 > Reviewed-by: Bobby Eshleman