Message ID | d140f8c3-d7d9-89b3-94ce-207c1f7990da@sberdevices.ru |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp215200wrd; Thu, 9 Mar 2023 02:40:04 -0800 (PST) X-Google-Smtp-Source: AK7set+eKqDLF6fQMY27qtpmLKc4z3vNTgttK5CKWEzG/1cfqT1wmpP1qSdkpWtnQvaBPPji4Yk/ X-Received: by 2002:aa7:9dce:0:b0:5a9:b7e3:2ee4 with SMTP id g14-20020aa79dce000000b005a9b7e32ee4mr21472494pfq.12.1678358404042; Thu, 09 Mar 2023 02:40:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678358404; cv=none; d=google.com; s=arc-20160816; b=qzYK2VLYW2ROdpfe/kBueyQ6Y+njirBkKorX7ZcH0DjFQRm258MZ8SdT4pJNKMyeio nqOoh7sqCk+AXS7VoEmgBtewBtZx/t3UrfQE/RiA0DQsdtZErE0/9BoExWWUuTyE7sH7 9iegt5msJKRj3oZBLiuYAoH+VXN6K1uWahV/MrdX3VoOyKxa12PMnLKGwrwavcSAn43P rZE8l/Arkyq+oFZYnbB4Lk155/qgq8Mr+r3ozKgoBJZxDrvp5W+M+04bRtwKHEa1+913 SrFFvw/JYjbr5ePlz1ut4FGDM7+I5w/kcL0jRQaoXHBDYdW5S3y2fv2o70ekHqBHwY3S M05A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:subject:from:cc:to :in-reply-to:content-language:user-agent:mime-version:date :message-id:dkim-signature; bh=twQ60nnpAyulvzxPcu0ha11knd8LOrgUyOb/wJN9jCA=; b=XUgjap4t/+KHmPursdoUQMcWcVFrlhPyK2xG1wrqBEztekL2SWUWHQ3/bg/XAZSzHT la+WAZfw3/vWlW8TzgT+a26AnasbEV+tfpVXZXMZOUmM1gaPcayCG6CuqJozsUDPKqnQ +gISTFqa/hGhq/Bucuvk6QcDPk26FJpdUIM2ZT3vl9tE43IgydUmjbQb/8S3JkyL6gd1 FFtTQwQqoRpTAHxMGsKKfurbJfeE64Hun+Jo4CFST2y374UHus5//OVKsCcinsMpxUlV U3QKRMV3iMg6XtG/YcNrOuhTBwc1YW0ZGpALKzt1CE6Te5jX0rzvQ83/L3O1gVLr8vJR SWhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=g19SdJjk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y72-20020a638a4b000000b00503011e4f27si16690701pgd.869.2023.03.09.02.39.51; Thu, 09 Mar 2023 02:40:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=g19SdJjk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231408AbjCIKSM (ORCPT <rfc822;carlos.wei.hk@gmail.com> + 99 others); Thu, 9 Mar 2023 05:18:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230450AbjCIKRv (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 9 Mar 2023 05:17:51 -0500 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57AA5CEFB3; Thu, 9 Mar 2023 02:17:00 -0800 (PST) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id A83955FD38; Thu, 9 Mar 2023 13:16:51 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1678357011; bh=twQ60nnpAyulvzxPcu0ha11knd8LOrgUyOb/wJN9jCA=; h=Message-ID:Date:MIME-Version:To:From:Subject:Content-Type; b=g19SdJjkunhov7Cg/9Iavuv6kt0M12I0iYQkitkTwzR2VeGWDJqUOiH6e+8KPyb/c rV9y1c8xRGF06lVYzXnSrLyWnSuJoznJG3aSfoIbEgcyR2geDcBZk9aywi2P8YTptu ruxwcZ5hHCLkeXyU9JSbBi9phTCT1l+95rIXeZmrGTQdK2KSt2+tNyllTwnpikivc6 7vrIK9BhZIwJ06k2Su2cljEPeSux6nFoAXYJc90x3xf/dQARPCZGsKrTc6P2O8hT+n U4NHFKrp6illpvUIvbYTkhvYFv8DyGc/6HuSZMRfB9z9BW7RozyIKcKEu3wl43jnG6 dxSJzG3Vfkueg== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mx.sberdevices.ru (Postfix) with ESMTP; Thu, 9 Mar 2023 13:16:51 +0300 (MSK) Message-ID: <d140f8c3-d7d9-89b3-94ce-207c1f7990da@sberdevices.ru> Date: Thu, 9 Mar 2023 13:13:51 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Content-Language: en-US In-Reply-To: <0abeec42-a11d-3a51-453b-6acf76604f2e@sberdevices.ru> To: Stefan Hajnoczi <stefanha@redhat.com>, Stefano Garzarella <sgarzare@redhat.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Bobby Eshleman <bobby.eshleman@bytedance.com> CC: <kvm@vger.kernel.org>, <virtualization@lists.linux-foundation.org>, <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <kernel@sberdevices.ru>, <oxffffaa@gmail.com>, <avkrasnov@sberdevices.ru> From: Arseniy Krasnov <avkrasnov@sberdevices.ru> Subject: [RFC PATCH v3 3/4] virtio/vsock: don't drop skbuff on copy failure Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [172.16.1.6] X-ClientProxiedBy: S-MS-EXCH01.sberdevices.ru (172.16.1.4) To S-MS-EXCH01.sberdevices.ru (172.16.1.4) X-KSMG-Rule-ID: 4 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiPhishing: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2023/03/09 05:43:00 #20927523 X-KSMG-AntiVirus-Status: Clean, skipped X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759886341839631329?= X-GMAIL-MSGID: =?utf-8?q?1759886341839631329?= |
Series |
several updates to virtio/vsock
|
|
Commit Message
Arseniy Krasnov
March 9, 2023, 10:13 a.m. UTC
This returns behaviour of SOCK_STREAM read as before skbuff usage. When
copying to user fails current skbuff won't be dropped, but returned to
sockets's queue. Technically instead of 'skb_dequeue()', 'skb_peek()' is
called and when skbuff becomes empty, it is removed from queue by
'__skb_unlink()'.
Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru>
---
net/vmw_vsock/virtio_transport_common.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
Comments
On Thu, Mar 09, 2023 at 01:13:51PM +0300, Arseniy Krasnov wrote: >This returns behaviour of SOCK_STREAM read as before skbuff usage. When So we need the Fixes tag: Fixes: 71dc9ec9ac7d ("virtio/vsock: replace virtio_vsock_pkt with sk_buff") The patch LGTM! Stefano >copying to user fails current skbuff won't be dropped, but returned to >sockets's queue. Technically instead of 'skb_dequeue()', 'skb_peek()' is >called and when skbuff becomes empty, it is removed from queue by >'__skb_unlink()'. > >Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru> >--- > net/vmw_vsock/virtio_transport_common.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > >diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c >index 9a411475e201..6564192e7f20 100644 >--- a/net/vmw_vsock/virtio_transport_common.c >+++ b/net/vmw_vsock/virtio_transport_common.c >@@ -364,7 +364,7 @@ virtio_transport_stream_do_dequeue(struct vsock_sock *vsk, > > spin_lock_bh(&vvs->rx_lock); > while (total < len && !skb_queue_empty(&vvs->rx_queue)) { >- skb = __skb_dequeue(&vvs->rx_queue); >+ skb = skb_peek(&vvs->rx_queue); > > bytes = len - total; > if (bytes > skb->len) >@@ -388,9 +388,8 @@ virtio_transport_stream_do_dequeue(struct vsock_sock *vsk, > u32 pkt_len = le32_to_cpu(virtio_vsock_hdr(skb)->len); > > virtio_transport_dec_rx_pkt(vvs, pkt_len); >+ __skb_unlink(skb, &vvs->rx_queue); > consume_skb(skb); >- } else { >- __skb_queue_head(&vvs->rx_queue, skb); > } > } > >-- >2.25.1 >
diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c index 9a411475e201..6564192e7f20 100644 --- a/net/vmw_vsock/virtio_transport_common.c +++ b/net/vmw_vsock/virtio_transport_common.c @@ -364,7 +364,7 @@ virtio_transport_stream_do_dequeue(struct vsock_sock *vsk, spin_lock_bh(&vvs->rx_lock); while (total < len && !skb_queue_empty(&vvs->rx_queue)) { - skb = __skb_dequeue(&vvs->rx_queue); + skb = skb_peek(&vvs->rx_queue); bytes = len - total; if (bytes > skb->len) @@ -388,9 +388,8 @@ virtio_transport_stream_do_dequeue(struct vsock_sock *vsk, u32 pkt_len = le32_to_cpu(virtio_vsock_hdr(skb)->len); virtio_transport_dec_rx_pkt(vvs, pkt_len); + __skb_unlink(skb, &vvs->rx_queue); consume_skb(skb); - } else { - __skb_queue_head(&vvs->rx_queue, skb); } }