Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp622158rdb; Thu, 19 Oct 2023 14:13:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGFLO2WfhwHtGRyHWzLV6QsN2qzmYgJvQ+wRr7aGDExoda4+Pisgkxc2Tn5uThqVeStwPG2 X-Received: by 2002:a17:902:d053:b0:1c9:c6f4:e0c3 with SMTP id l19-20020a170902d05300b001c9c6f4e0c3mr40034pll.62.1697749990950; Thu, 19 Oct 2023 14:13:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697749990; cv=pass; d=google.com; s=arc-20160816; b=xcyZdCFCaIONjEYUu/KPucTW5KZswgsQ9+zGPKj2CKOOo2RDeX1SmlJvxTBT320sTW PapjRGcttmxpqXiCeSg+Wc2RpV+KsVaUX+8d/xHheWtyT8qvnR7GCgoOXxIwCsjfCFNt RFETXCgrm67KOjJqZ21CK+u1R0YAUV8YsdIXonDObgiMiMcpZpO8np2PRI/MFxbSd+ux teYnwlrBR/7BftplXse3TY4JvLAgYmyJVD63BGRQFqf1DOiEuCl8+UAF+sBcjvSLdQ3v vSdlEXpsHRKj/QmXQV8WGANB3foaSPJDaxUISbbSFQbvSIeWCHwO+Mays/9mekcxgh/9 kKEg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=GJFbBKOlle9Yc91IgLmqNSawkv91bp+2ZMasQkci0oA=; fh=xtntlvGZCIqJG0xQQmMbs5TDuzWZIbmAv4GDXkx6lak=; b=e5tqw3Ltx8qt4mO9GBqvcgz5ggOimybtKMPfP+j6y/k8wTvc+ZyUhm4ISZnFBQCA1O NGm5lz/BVX4kOT/khSfcZHFzOlD5JJ4bFCX7X9/TbljHtPbG5izgMKNXyinbC7PKniBD JHB+FeCEzX29LPAuy7kL6D2DLrhC/dwDQp71YfG8aGHOdCe97TOB0pXIJ4hti9Q7doay kwXNJxxw0AxgkDDltDadoGkLT5gfIeItJ3SbM9KAts3cGspyxRYdUegFbV2jHt8atKgr T+2m4nQlck9bdxZA59VOKtrc+nxXjISoh0EPuLjw6LYSU8lKHXFSKhrlyulMCQLFCY91 TCUA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@uipath.com header.s=selector1 header.b=q7nJhnw8; arc=pass (i=1 spf=pass spfdomain=uipath.com dkim=pass dkdomain=uipath.com dmarc=pass fromdomain=uipath.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=uipath.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id ij26-20020a170902ab5a00b001c9cc838d72si340900plb.125.2023.10.19.14.13.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 14:13:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@uipath.com header.s=selector1 header.b=q7nJhnw8; arc=pass (i=1 spf=pass spfdomain=uipath.com dkim=pass dkdomain=uipath.com dmarc=pass fromdomain=uipath.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=uipath.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 974E28197043; Thu, 19 Oct 2023 14:13:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235541AbjJSVM5 (ORCPT + 99 others); Thu, 19 Oct 2023 17:12:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232548AbjJSVMz (ORCPT ); Thu, 19 Oct 2023 17:12:55 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2105.outbound.protection.outlook.com [40.107.6.105]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AE6E182; Thu, 19 Oct 2023 14:12:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OSiICQe9+d4ymGX+VaVk0hkEbnZxHDU0mnhtg46So25KnLXs2hXcYyF1wlgdS1xYyCwk3hj59rOga43EqpxkrGxEaEjC/5iVCMhstpXg+DBY2mOPKaKrTeWVdLgodc/+ioDN5agZ1ASGIDrWjNcBM60jtlCyfPMNT4pcwpr+/HBb21uk1/4v6TLbBmpa1eAx4NuiXKvJvU0qQLbljuLWPK/+R5hVrFZGKXtzqviE3aueQUdXpFOq1TNdIaqb3JFQQGz03USM9gnHU5CJ+kcTJIoXUGa9pTy73Ffq9WatFRJC1J651fC3x0ZvnHmdIm9g7IRG6UdTLd3KLfR4/TOQvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GJFbBKOlle9Yc91IgLmqNSawkv91bp+2ZMasQkci0oA=; b=gbozbdAqgVGLrFNzmMb2VnCm1dG/FDW9KWXqOcOBGdkoVa5QIY9gSGUq/NUWiHS9LHr20u+3q095xOgbV4kX4PzeUA+EPNjnUgzjKUu9/vkVF6APPV8iK2ABrDOSRMC7Kys27Zacj2DjURU8NWE886iBRYSvNf9U4fNV8XKQCraiUHoZmUiOBTkf3d2jGirXNtopXe9ZmJEnH1MuJOMf2EfI51ihHxKz7Hp3fVbqHIG618YHjejnTCUY3iGnOkxbEJYNeCBSzRYjULwx/lsl9CWV7CE/sR7yRfjBPOoUpSalLC+rbA9t/dhnHdcyzGw2ZGKjh+ofXq+7vHW1SkiuRA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=uipath.com; dmarc=pass action=none header.from=uipath.com; dkim=pass header.d=uipath.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uipath.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GJFbBKOlle9Yc91IgLmqNSawkv91bp+2ZMasQkci0oA=; b=q7nJhnw8wVI6s39iCLay5eNXwGjpr+QOJxnNbF5VB+H9UMYDN060by2fJXd+uEkPnLgZxKEkEnZwdN65gD/XqbLIrSkI9ZQakBhF3/3ybNhG9K+/cdexAJ75/QCPfKNw8oOaXvb9chBFmEJ++xwPmM0M4+Pm6l0cig+8dmkhGFL991jkPbPLkfAJb6I0vg50ySACH3qfn9gidvy0DnEAfZXIcCdx8/DzT/N8mpgoGDl5noZ1AWhFoO3Cm+lxhKrH9H3LXJQSA3Jbqi3yHAyMrUgu4etTvILwZ+c3JKUxrTRgw5oaOFtTVLnUDOXIs5iLtSOz+yAPPZFrAWEg2jzHhg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=uipath.com; Received: from VI1PR02MB4527.eurprd02.prod.outlook.com (2603:10a6:803:b1::28) by DU0PR02MB9467.eurprd02.prod.outlook.com (2603:10a6:10:41b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.21; Thu, 19 Oct 2023 21:12:51 +0000 Received: from VI1PR02MB4527.eurprd02.prod.outlook.com ([fe80::717d:6e0d:ec4b:7668]) by VI1PR02MB4527.eurprd02.prod.outlook.com ([fe80::717d:6e0d:ec4b:7668%6]) with mapi id 15.20.6907.022; Thu, 19 Oct 2023 21:12:51 +0000 Message-ID: <126c3133-2bca-4bb3-9cb2-7ca4fae2eda1@uipath.com> Date: Fri, 20 Oct 2023 00:12:48 +0300 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] vsock: initialize the_virtio_vsock before using VQs Content-Language: en-US To: Vadim Fedorenko , Stefan Hajnoczi , Stefano Garzarella , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Mihai Petrisor , Viorel Canja References: <20231018183247.1827-1-alexandru.matei@uipath.com> From: Alexandru Matei In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: VI1P195CA0057.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:5a::46) To VI1PR02MB4527.eurprd02.prod.outlook.com (2603:10a6:803:b1::28) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR02MB4527:EE_|DU0PR02MB9467:EE_ X-MS-Office365-Filtering-Correlation-Id: c7f60476-e472-47cd-1bed-08dbd0e82696 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fQp7tcWfLwa9id0jR46HvR0KuWR7krTkrrjjioVpjqTf/emXo6EgNvY8A2Qhdbf1LuGQ/SaWy6Out8R0BwO/CYOVDopq/w5yeUMvjZ9NYHUIK7bM6kdrLXlaaNwNHrtlJhtaN9biCL/ZIOtZmlwx10Po0CQwZ3VKSolyXFFYrxx+H3Dz4H5GvUCBWxC3bks0fDLwEMDZnq6L5S7dDetvNn3kA1BF2ceWafri0LFUE97vUog2YjzM/GpeKC5J/mejHqXRpjQiX6xeNZNDYAvUgb3MsuVLpszjPofR6CXdLyty2NK1Mx77UXABO4XDeHXLEPlEvyiGJgmrDL7IfDjfNIJuxo+7gB/gXZ2J6GofJk7BXzeCN/BuNrFAHyb77C+8aG7oxEBbDxjEEP7iCmbKdx3MwWpaXtUb2H4lkOynaRRYT6TPFilhfXw8eR0q5sWPOl5BOmdUcdBqMAIo8BaPIac0oWC9KZof+fZM1ryLsAandk2VhQDceRCt7kiUBq6YsLd1M460/JK28Ker6v7bZmeSOLKRhrKrO2hTAAoAnVvrIo07uPIAlP4d2BFzWNG8E7TU5f4bbW17NOMXDZuWS4iPRuiiHanHx5S96mD7F/2RkaDrWAycSB/RI8C2N7QXM2snPSm+tCG1+eCFATJQCQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR02MB4527.eurprd02.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(346002)(39860400002)(396003)(376002)(366004)(230922051799003)(451199024)(64100799003)(186009)(1800799009)(31686004)(54906003)(2906002)(7416002)(5660300002)(26005)(8936002)(41300700001)(44832011)(4326008)(8676002)(107886003)(36756003)(31696002)(6512007)(6506007)(66476007)(66556008)(86362001)(110136005)(38100700002)(2616005)(478600001)(6666004)(316002)(83380400001)(6486002)(66946007)(53546011)(45980500001)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?OEVyUmE4S3Fzd2p5UVZpNitWR1Zhdk1TcXJUSUliQ1hwaUZHUWp0K3lPK3BM?= =?utf-8?B?R0cwdzBuU25Wdm5BeWRvRjNsNXo0WlowcXdrTmZBUUpUcDlvSG83MUt3S0ZD?= =?utf-8?B?c2NMOXgzbXZwN0dHaHRSVUdIdDdBeVF0MmwwWHpodldXdVNJWnJqSVQ3Q1Rz?= =?utf-8?B?WTRINHhsNTV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1MyVFRUbzdwQjVHWlJtb2JNbFdEYlNaOTZPUEZQOGpzbzMvYXhFNDY0WW00?= =?utf-8?B?TStQNHdnQWMyS0k1Y0todklYUnlsVXV2MnR4VjM3a0ZwVWI0L3BncmhZcURz?= =?utf-8?B?Q2FOUWJJTWYrbFRJU1cwVlNwdk9JOXIzZ1JGczF3SmszcmZ4Q0tKcDlLVGdp?= =?utf-8?B?dEE9PQ==?= X-OriginatorOrg: uipath.com X-MS-Exchange-CrossTenant-Network-Message-Id: c7f60476-e472-47cd-1bed-08dbd0e82696 X-MS-Exchange-CrossTenant-AuthSource: VI1PR02MB4527.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2023 21:12:50.9266 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d8353d2a-b153-4d17-8827-902c51f72357 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 44neU2rj/uUlFYaRi2x1bzJ/xVYHJqcTDU/GTag+RNJf3zRhS+ss6ie19Fx2BI4Jdqr2DR//3I0UDLgxMqXwL11+y2NNo+I5peDeGZkw+WE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR02MB9467 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, 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 agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 19 Oct 2023 14:13:08 -0700 (PDT) On 10/19/2023 3:12 AM, Vadim Fedorenko wrote: > On 18/10/2023 19:32, Alexandru Matei wrote: >> Once VQs are filled with empty buffers and we kick the host, it can send >> connection requests. If 'the_virtio_vsock' is not initialized before, >> replies are silently dropped and do not reach the host. >> >> Fixes: 0deab087b16a ("vsock/virtio: use RCU to avoid use-after-free on the_virtio_vsock") >> Signed-off-by: Alexandru Matei >> --- >>   net/vmw_vsock/virtio_transport.c | 7 ++++--- >>   1 file changed, 4 insertions(+), 3 deletions(-) >> >> diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c >> index e95df847176b..eae0867133f8 100644 >> --- a/net/vmw_vsock/virtio_transport.c >> +++ b/net/vmw_vsock/virtio_transport.c >> @@ -658,12 +658,13 @@ static int virtio_vsock_probe(struct virtio_device *vdev) >>           vsock->seqpacket_allow = true; >>         vdev->priv = vsock; >> +    rcu_assign_pointer(the_virtio_vsock, vsock); >>         ret = virtio_vsock_vqs_init(vsock); >> -    if (ret < 0) >> +    if (ret < 0) { >> +        rcu_assign_pointer(the_virtio_vsock, NULL); >>           goto out; >> - >> -    rcu_assign_pointer(the_virtio_vsock, vsock); >> +    } >>         mutex_unlock(&the_virtio_vsock_mutex); >>   > > Looks like virtio_vsock_restore() needs the same changes. But > virtio_vsock_vqs_init() can fail only in virtio_find_vqs(). Maybe it can be split into 2 functions to avoid second rcu_assign_pointer() in case > of error? > Thanks, it definitely looks better and it solves a few other issues by splitting the function in two.