Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3993775rdg; Wed, 18 Oct 2023 11:34:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFA6BzyssoXwMyXEl25W5kURTeO4daA3IesFkOKi6oKlvae6u9XCzl5gSCK6d7vVnx0bi7F X-Received: by 2002:a05:6a21:7781:b0:16a:4f24:d30 with SMTP id bd1-20020a056a21778100b0016a4f240d30mr5995777pzc.53.1697654040983; Wed, 18 Oct 2023 11:34:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697654040; cv=pass; d=google.com; s=arc-20160816; b=FE/0G3qH7alln1C/jgAd7BpZWafy5zfiN71PHXU9NQ7mcq9UbIAq3klL5oXGpbNUjz xRv4WoPclbw9M7TG8i8RiHNrm3kxhK8apy6JKHpGP6thz59dZTCQY2pyrWnYog0uUdDP KBKjOmjXyk3JH7yOBHs0XMjchXg7MXMkZy+60R4/dFYV2V+9/TjkVq5fDfO2pDxP5kRO tBYxCfK5GcCJikLcMaEfHaCp4pSBt2H85HhduGcvRmevZZi8Jj8fgfNXrVGxgI5hNQ3K Wm+VKNJIxyWEJ2/ggrHQFq/z51MgvsEKKTPGkgxrfVWI8dDsAZ+QeAg8XUEMhzv2n9kE o4mA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=evUAGQf5IYhFKWZHAxtq8BuJvPx+ARK5yZPGDZy0KCE=; fh=KRRvFMoxb0lLz/DuqmV7BnCeMI9Dv3OJsBuY2yzPp1o=; b=nZ0uIX1q/Yq7c9fGIkAJ3S4MZumta8jyj/fXXUWMzhiNVHxHWggkUfmJMZZVCzLvi2 JOObbjT/CG4wB7On0mHOqezEyGLvxI7OAdCr8MjtE4Dn+3iDPte4Pmkj8lGnbdqjfJZa itI7AkLt9SRnz5E/QAwaORdRVLMmzFocm+uLQHW6Bp+BNHzjLXaFT2UQ8YCXjG3hIHQN FyOc2WRaOEbltbOellspEYzGzu51rLh2PPWvPpXuNYeACEUQlLkEmG96wMBrwEQOAr15 Hv0t6bbWtGR+T1Wv4RgQgGKtjUibJEWqo0433UMxLpZbCHg9XeYHEI36n8SbrJhkkXka Zv5Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@uipath.com header.s=selector1 header.b=dLj+9Akj; 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.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id rj8-20020a17090b3e8800b00274abe06b0asi380418pjb.127.2023.10.18.11.34.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 11:34:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@uipath.com header.s=selector1 header.b=dLj+9Akj; 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.34 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 howler.vger.email (Postfix) with ESMTP id 42D4881143C8; Wed, 18 Oct 2023 11:33:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344786AbjJRSdf (ORCPT + 99 others); Wed, 18 Oct 2023 14:33:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232603AbjJRSde (ORCPT ); Wed, 18 Oct 2023 14:33:34 -0400 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2130.outbound.protection.outlook.com [40.107.13.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31312114; Wed, 18 Oct 2023 11:33:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dbdE2xi4ItJvpZsQt76xwj9f5cm8bIrTzOf1fS32U7L07KH2GQNKrfKJeMe5ryEV5qFlb19nTK341xyTpxTGg/MM4AXdVUFSw6NiGms2MwBl0A3Jp/tVsx9wkNjD9QBUpxfqZ3v72pp3tOrB2/hotpFSRrZfh8cBe3qoxFvbwjtYpww4j0oENpkJf8fFANF39/Ofev0+OhvMP5UJwOqHMj3bChufKaT+TkPjgRDV1gw4lOtXhlcsHfYiu/2FYFuelQnhMbS4zQVt5F74DEcevf2vKBpDrJ/PwY2vGipsqBISFlwIa2ZMqHjzr1BHtRAJrx/3aTC2LDrsugqlsr0WAA== 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=evUAGQf5IYhFKWZHAxtq8BuJvPx+ARK5yZPGDZy0KCE=; b=Hh0N9xzHLMPuAA51qU/Vi5EAkeeMXb5GLzNQMTX/DIs9x9xHfvVSHgqxPlUwDhsXVBFYTnBJCckjL3COc5cRVwqcdaO3R3CC8Qx0jn1e4rwFGdgLFAHhXbwBaMvjEdnhvhaolwVtx+0mghFzQyW2jT/MnCR4brbUfxyF9ByGz6G4ksT0HmVaccSE2ayvgJi77Yb1LE1xPkZVhsBmj2reVUAjXdTyzdrQPspAtTuehVxJcerY0Xqpm3+arU5QxQokz7ZtXDXa6x27eHP8prKQmsLlepVcHMYQ9zpienFgFqm/ce99jrmLpzT8D6Ee1gRAlOrl4/rpiftdEsEhhzP6iw== 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=evUAGQf5IYhFKWZHAxtq8BuJvPx+ARK5yZPGDZy0KCE=; b=dLj+9AkjYHjvpChYDRqREaK2t73MKH81OXUuGKA+hB+UYMbrCuWXvK+XPGPryYABqeOs9hEKVqHJgVt6kJM95I8KSE+YDk2HgK9NfA/pnC78u5xT3XMKhvD1to8ypXnXLw8tJ5bdPEVoau5IBA8YFIatPJJ/2EQjOxqzhPnDZi8mGEPVFwWAXsA7dUv6uxuk068FFML1jZ+uW2LnCdWEcgYozam/LT16o96akn2nUMmrXFfjay8YiShYQrkb2yrJa5dXl6O2QHGL94kgn/cd5ybkCuTRxRmocJxXWXkmMH0Q+5k0EmSPf+SGuM+aDsnDJM49bEjlOidQp6aRVfaAQw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=uipath.com; Received: from DB7PR02MB4521.eurprd02.prod.outlook.com (2603:10a6:10:65::25) by AS2PR02MB9191.eurprd02.prod.outlook.com (2603:10a6:20b:5fb::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.22; Wed, 18 Oct 2023 18:33:27 +0000 Received: from DB7PR02MB4521.eurprd02.prod.outlook.com ([fe80::c3aa:5631:dfe9:e09c]) by DB7PR02MB4521.eurprd02.prod.outlook.com ([fe80::c3aa:5631:dfe9:e09c%4]) with mapi id 15.20.6907.022; Wed, 18 Oct 2023 18:33:27 +0000 From: Alexandru Matei To: 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, Alexandru Matei , Mihai Petrisor , Viorel Canja Subject: [PATCH] vsock: initialize the_virtio_vsock before using VQs Date: Wed, 18 Oct 2023 21:32:47 +0300 Message-Id: <20231018183247.1827-1-alexandru.matei@uipath.com> X-Mailer: git-send-email 2.25.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: VI1PR0102CA0033.eurprd01.prod.exchangelabs.com (2603:10a6:802::46) To DB7PR02MB4521.eurprd02.prod.outlook.com (2603:10a6:10:65::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR02MB4521:EE_|AS2PR02MB9191:EE_ X-MS-Office365-Filtering-Correlation-Id: 1c7cefad-7339-4899-8dae-08dbd008b837 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qHbdFQoZWtccWB8ItB/6jW7p6jJDHEPwb/oS1LGJpsAkGBUTp65rrJh2SX72GpWfmZnxIHe+lyEXxpm3TA3xrSQY3dQXW7G68z/LXpkVcBE9BKx/1LlbdYBFWdi4uqCGwFKIYKkbRoqvKxZthAzBuyG/Tc5bFS+QR2KwAeVBoGDC3TOKHnSJb1HvuMGKoPm34g9jvSbFvYAVQgmAIDsmNk6fdOBO9GwUX93n0rXIIYSoIPz4gKnJ9a8vM+lIyTCyNH44I3chFNSTx5sbRtEAFNHS3J545LFEu5uRquUhekUH/YbOt4UxKFxtZmO9YeneH7oDoGhDDzr02nbYHWVhd1x211hvj1vqcOgkxkC+syJKd2M4QZvfnJqXtpH9lCQ0W9W9KjasaGqGD5bdK50Zhu38D1jcLpZnYuDKt52z9EEuCh5tjVpBVSekHGbWM+ow/mjmyTxsUMeUX7aW92ObdJZAlUvUaV8iHNQ3ei9HXVW8F3G+rAqJYaFsxqL6rBfxqHUk5CgQvhnozgJ6FxzgOg6hKj/p/GWyJP7iVDuaBBgp3+LfPMqe8R2P5XU9wjwa X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR02MB4521.eurprd02.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(346002)(39860400002)(376002)(396003)(136003)(230922051799003)(451199024)(64100799003)(186009)(1800799009)(83380400001)(38100700002)(107886003)(2616005)(36756003)(6512007)(44832011)(316002)(66556008)(478600001)(110136005)(66476007)(2906002)(54906003)(7416002)(66946007)(1076003)(8676002)(8936002)(4326008)(5660300002)(6506007)(6666004)(86362001)(6486002)(41300700001)(26005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?D4wUM33fliEQFIk3XKu9k/rXam/yrTmqERYGmkvbScA9uGvkautfn9PhqevN?= =?us-ascii?Q?zxy+LiwNlVFht5oN2A2wK5DQCuHc8Mv2FdDQiCn3wdB8IvE8Qi/epKIvaiW0?= =?us-ascii?Q?LIPCZIO3flEL9k0oQpRiIz+vSxkC+ltEeqyUHnPt/p6Jd+S1AqSjxS3BHyEx?= =?us-ascii?Q?2rdg+QhHPd/WbW0lVKcErikC6ZtUIb739IA83S+uK95geCKFhDzUHyNJersL?= =?us-ascii?Q?7nsKjavF6yaaoD6EqkkoPeupMgr7wctQl3w9rKjEvv844FQObBI1NNd4vUdM?= =?us-ascii?Q?kJ1FsSp3DFxjnFA43020HHciOuZyII4zB7fW3Kfz792lZ96So7H9Rzc/+obY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oadVdl2742Gp/l5wYiNrrY4at8qMXBP3sJs9yRr?= =?us-ascii?Q?Q+iBh+rYtkynvSTJ21R2XallvpYoShi4tv+mQMSNgOCSd/fijiVm10lKhxQq?= =?us-ascii?Q?SP7G5ZIeeOm5OeOfN5lnYHIb59njf6v6lWQv/gHb/Kn2AX7I9b/0H7DaKCkD?= =?us-ascii?Q?DzZnLCUfzXgxJBAwvMYg9qDGTtDm8kPIwURFmtRV08G4dvB9B0j3YfWU2mW4?= =?us-ascii?Q?VfubE9MtPMGlAom5hgapLxZRDVBWPvKQ5DZcCp/3nr89nylKKNS4gSYzlQVq?= =?us-ascii?Q?+9ieUFq7s7G3aoLsCi52pIpQ79JUP206fx3txCrWqyhpJxu3MxwMaSmxdOAk?= =?us-ascii?Q?NGMRwjRIV+1/8Los/rofSkPTTqg2YgQj3uitHWERgIhPFvPK+hw7YN/reHnA?= =?us-ascii?Q?bQ=3D=3D?= X-OriginatorOrg: uipath.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1c7cefad-7339-4899-8dae-08dbd008b837 X-MS-Exchange-CrossTenant-AuthSource: DB7PR02MB4521.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 18:33:27.3743 (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: rs5kvZ68z56DeECIZL+WVU4kdZCiNU/AL9ekh3zrldQVfZE1OQ8FkIjk//vCAPpDZpou5UpFCichbY9+pkgJm4iIaJOrl6NQt+NER2IyrTY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR02MB9191 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 howler.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 (howler.vger.email [0.0.0.0]); Wed, 18 Oct 2023 11:33:57 -0700 (PDT) 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); -- 2.34.1