From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 80EE01370 for ; Fri, 5 Apr 2024 06:31:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712298670; cv=none; b=jaJ+MZGFOv327J2xfL0FVN+HTtnykXBPZi/wNhF2CH5FDDCbrlYgj3L0Le5/6EJTWsDvQpv+odoErXGqalo0itW1mT7Q6X1XLilaOTk+oFkh+wKADCa4aymJYdsof167BW5+qlZ+BS7bvadAhw0jxzdTiN+kYPk3x//oocAXQMA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712298670; c=relaxed/simple; bh=sz9hYl8OMWpxmC4XhxnyPJh2nq7avH/TSFavQTLbJSg=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=HML3fAxcPAZ0+5PC9+brdAUXYgcutgA9mA3WyMsqjgJKYdPmTRNc2dgSOf8oBvkMFYH833/NC+vdK1lTt0VSsY3w1hpHtH0o1NjH5b9/uZX9hxmcnSHLc1H+sRERUj04m08bAa/mGesRV2z8N4zxnppEBwccvEu52FsItMhUtgM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=a9BLUSuW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="a9BLUSuW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01269C433F1; Fri, 5 Apr 2024 06:31:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1712298670; bh=sz9hYl8OMWpxmC4XhxnyPJh2nq7avH/TSFavQTLbJSg=; h=Subject:To:Cc:From:Date:From; b=a9BLUSuWxHYy0Hx6VB2ztns5r/4qaZpTSkwvnwla57U0rW0rMs8I6reCwTDbNJjXh G+qD8FGWHvDqJfe/PFKHprLYe2TSmpGGjazTFzrDkXdMUbE4FZ1yGkHsypcuOVnd8F snGxzSa+fZoWGX40SbW4M/2TMhf81Fe4CZBgbhtg= Subject: FAILED: patch "[PATCH] vsock/virtio: fix packet delivery to tap device" failed to apply to 5.4-stable tree To: marco.pinn95@gmail.com,kuba@kernel.org,sgarzare@redhat.com Cc: From: Date: Fri, 05 Apr 2024 08:30:57 +0200 Message-ID: <2024040557-jeeringly-random-fd56@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.4-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.4.y git checkout FETCH_HEAD git cherry-pick -x b32a09ea7c38849ff925489a6bf5bd8914bc45df # git commit -s git send-email --to '' --in-reply-to '2024040557-jeeringly-random-fd56@gregkh' --subject-prefix 'PATCH 5.4.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From b32a09ea7c38849ff925489a6bf5bd8914bc45df Mon Sep 17 00:00:00 2001 From: Marco Pinna Date: Fri, 29 Mar 2024 17:12:59 +0100 Subject: [PATCH] vsock/virtio: fix packet delivery to tap device Commit 82dfb540aeb2 ("VSOCK: Add virtio vsock vsockmon hooks") added virtio_transport_deliver_tap_pkt() for handing packets to the vsockmon device. However, in virtio_transport_send_pkt_work(), the function is called before actually sending the packet (i.e. before placing it in the virtqueue with virtqueue_add_sgs() and checking whether it returned successfully). Queuing the packet in the virtqueue can fail even multiple times. However, in virtio_transport_deliver_tap_pkt() we deliver the packet to the monitoring tap interface only the first time we call it. This certainly avoids seeing the same packet replicated multiple times in the monitoring interface, but it can show the packet sent with the wrong timestamp or even before we succeed to queue it in the virtqueue. Move virtio_transport_deliver_tap_pkt() after calling virtqueue_add_sgs() and making sure it returned successfully. Fixes: 82dfb540aeb2 ("VSOCK: Add virtio vsock vsockmon hooks") Cc: stable@vge.kernel.org Signed-off-by: Marco Pinna Reviewed-by: Stefano Garzarella Link: https://lore.kernel.org/r/20240329161259.411751-1-marco.pinn95@gmail.com Signed-off-by: Jakub Kicinski diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c index 1748268e0694..ee5d306a96d0 100644 --- a/net/vmw_vsock/virtio_transport.c +++ b/net/vmw_vsock/virtio_transport.c @@ -120,7 +120,6 @@ virtio_transport_send_pkt_work(struct work_struct *work) if (!skb) break; - virtio_transport_deliver_tap_pkt(skb); reply = virtio_vsock_skb_reply(skb); sgs = vsock->out_sgs; sg_init_one(sgs[out_sg], virtio_vsock_hdr(skb), @@ -170,6 +169,8 @@ virtio_transport_send_pkt_work(struct work_struct *work) break; } + virtio_transport_deliver_tap_pkt(skb); + if (reply) { struct virtqueue *rx_vq = vsock->vqs[VSOCK_VQ_RX]; int val;