Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4109317rwl; Tue, 28 Mar 2023 02:45:33 -0700 (PDT) X-Google-Smtp-Source: AKy350ZtW1mzq1SaxP4GBa5s5+UKZr9Bbv4tbXm9GYhRsVvYqRuDCLlzEVhvYY7oiwzKVh+vAAps X-Received: by 2002:a50:ed17:0:b0:502:5288:e37a with SMTP id j23-20020a50ed17000000b005025288e37amr1519049eds.6.1679996733327; Tue, 28 Mar 2023 02:45:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679996733; cv=none; d=google.com; s=arc-20160816; b=QEeuY2WKlI6s93lNI/iOKJAXRDLbkonhTJKB7aA9D1RGO5UG1DJtD6eZPRy5IWrLtX sbhJTLIDKH9/+z2rjUlR8Cmdkj2zdWlNj3FFqy7SZOqDpYcruNeVj++HmwJ6XN0dHVUB akdRO9oMbmY3wFbt4mdbA035GoKtqhK1RLn8eiNfzINHlo13AVDfs66X3a9otavYuk7U puObKpEUTjiBnWXrJhCBUhAc4Oc0DcskVgLp5gIlG629AXpdpf+wGM9V9xHcH36daPFZ 3qjGbhO8gHKWXwqVm9gV4JqsoilV5/5TBaNvp0CO1It8PDg/UTQzST2cLEAjCm9h+TrE ihbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=3PbLJXlMS03N1z+S8n5YYeRBHkPx2Jy2H4fazX9eSgM=; b=f8rrKV2cG1qRJf5yWqlHeXBDij455nSTfHZmnl29qu2I9iTR/8HIk69DfIE5tJtcap jbc+d/1p+yLkmYfdpSK1B8SKgbk1P3W4YZlGEi93h1w0PyeMhpLqHp92tsA3A3TNurq5 wce4B42kfHjaxunmupnAP8vW4KeUEq4jff7HSb77ExBEvUwxnvrQ8gs9qZ5HRydjpiLH yRRDMNO8G2BXPkuEIfS9yCh006+sOwpa1fZJsFEnkDDK6zKWth2p36IFy+957v7eWXht H98n7rUfAoLacAXimW4MRMdimtAcrUtfLaWrhJyv/4hRWsMGH5v41DkfP7uX1ZJMWBXB sRXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=l1n8TpPu; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j5-20020aa7c405000000b00502259be703si10343662edq.434.2023.03.28.02.45.08; Tue, 28 Mar 2023 02:45:33 -0700 (PDT) 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=l1n8TpPu; 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 S232912AbjC1Jg6 (ORCPT + 99 others); Tue, 28 Mar 2023 05:36:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231561AbjC1Jgj (ORCPT ); Tue, 28 Mar 2023 05:36:39 -0400 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39E9C7DA0; Tue, 28 Mar 2023 02:35:41 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 2F2215FD0E; Tue, 28 Mar 2023 12:35:38 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1679996138; bh=3PbLJXlMS03N1z+S8n5YYeRBHkPx2Jy2H4fazX9eSgM=; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; b=l1n8TpPu/p6OJEkJNH6kOrwK+E/UeccbzVOc2ZMwO6mRYUox6066R3ViEh/LNc0mY HCWM8AHxjGpnVvodnApWGoeNnrkKSOqC7KVtnTuA3Z7jUtkLS5iNZ1+ox99WxVtsOe Z/n+wtlZJ5BsDr3ZI+0hvehBwIzxXYoTMMiuUoM7PkTUQ1BOx4to4ggxPLEElT9cy1 y0+1R597Il65L1Nvel8NhfFng3718nIVDqPXj6T2mZ/zlqRbXO4N0Xc2JvVE7dIyoI DDYsvoO6mJE2+N7BDTNejUyrrHVq/LhpUm7dm0b8isySObpvetM/F/T2wAV3Xz7SrB tva+dyucyWp2w== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mx.sberdevices.ru (Postfix) with ESMTP; Tue, 28 Mar 2023 12:35:34 +0300 (MSK) Message-ID: Date: Tue, 28 Mar 2023 12:32:10 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [RFC PATCH v2 2/3] virtio/vsock: WARN_ONCE() for invalid state of socket Content-Language: en-US To: Stefano Garzarella CC: Stefan Hajnoczi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Bobby Eshleman , , , , , , References: <728181e9-6b35-0092-3d01-3d7aff4521b6@sberdevices.ru> <30aa2604-77c0-322e-44fd-ff99fc25e388@sberdevices.ru> From: Arseniy Krasnov In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit 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/28 06:38:00 #21021220 X-KSMG-AntiVirus-Status: Clean, skipped X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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: X-Mailing-List: linux-kernel@vger.kernel.org On 28.03.2023 12:29, Stefano Garzarella wrote: > On Sun, Mar 26, 2023 at 01:09:25AM +0300, Arseniy Krasnov wrote: >> This adds WARN_ONCE() and return from stream dequeue callback when >> socket's queue is empty, but 'rx_bytes' still non-zero. > > Nit: I would explain why we add this, for example: > > This allows the detection of potential bugs due to packet merging > (see previous patch). > >> >> Signed-off-by: Arseniy Krasnov >> --- >> net/vmw_vsock/virtio_transport_common.c | 7 +++++++ >> 1 file changed, 7 insertions(+) > >> >> diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c >> index b9144af71553..ad70531de133 100644 >> --- a/net/vmw_vsock/virtio_transport_common.c >> +++ b/net/vmw_vsock/virtio_transport_common.c >> @@ -398,6 +398,13 @@ virtio_transport_stream_do_dequeue(struct vsock_sock *vsk, >>     u32 free_space; >> >>     spin_lock_bh(&vvs->rx_lock); >> + >> +    if (WARN_ONCE(skb_queue_empty(&vvs->rx_queue) && vvs->rx_bytes, >> +              "No skbuffs with non-zero 'rx_bytes'\n")) { > > Nit: I would rephrase it this way: > "rx_queue is empty, but rx_bytes is non-zero" > >> +        spin_unlock_bh(&vvs->rx_lock); >> +        return err; >> +    } >> + >>     while (total < len && !skb_queue_empty(&vvs->rx_queue)) { >>         skb = skb_peek(&vvs->rx_queue); >> >> --  >> 2.25.1 >> > > Anyway the patch LGTM! Thanks for review! Since only string value and commit message should be updated, i can resend it with 'net' (as it is fix) and update two thing above in 'net' version? Thanks, Arseniy > > Reviewed-by: Stefano Garzarella >