Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751626AbdHRPu0 (ORCPT ); Fri, 18 Aug 2017 11:50:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36248 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750846AbdHRPuY (ORCPT ); Fri, 18 Aug 2017 11:50:24 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9BEC47E431 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=stefanha@redhat.com Date: Thu, 17 Aug 2017 15:05:41 +0100 From: Stefan Hajnoczi To: Dexuan Cui Cc: "davem@davemloft.net" , "netdev@vger.kernel.org" , "devel@linuxdriverproject.org" , KY Srinivasan , Haiyang Zhang , Stephen Hemminger , George Zhang , Jorgen Hansen , Michal Kubecek , Vitaly Kuznetsov , Cathy Avery , "jasowang@redhat.com" , Rolf Neugebauer , Dave Scott , Marcelo Cerri , "apw@canonical.com" , "olaf@aepfle.de" , "joe@perches.com" , "linux-kernel@vger.kernel.org" , Dan Carpenter Subject: Re: [PATCH net-next 2/3] vsock: fix vsock_dequeue/enqueue_accept race Message-ID: <20170817140541.GH5539@stefanha-x1.localdomain> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="qVHblb/y9DPlgkHs" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.3 (2017-05-23) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 18 Aug 2017 15:50:24 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1126 Lines: 31 --qVHblb/y9DPlgkHs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Aug 15, 2017 at 10:15:39PM +0000, Dexuan Cui wrote: > With the current code, when vsock_dequeue_accept() is removing a sock > from the list, nothing prevents vsock_enqueue_accept() from adding a new > sock into the list concurrently. We should add a lock to protect the list. The listener sock is locked, preventing concurrent modification. I have checked both the virtio and vmci transports. Can you post an example where the listener sock isn't locked? Stefan --qVHblb/y9DPlgkHs Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJZlaK1AAoJEJykq7OBq3PI6gIH/jhIxXUNZC7Kl6ciq4VSGrSi PpsiYAKmye3ayDB7IObQn8o3vHRZyWJbbb9Rp8sN4ysmtPohtCNo2FhBJHwpwwjC BpVZDk4GnmBLDlkhvzRtII+wWu1+mAy5hFCdwHaxuJdiACJOXU85mr6yGeWZH12D 9Kab5kgxZ8njSt3ICU4yk+QSuW/CP09ZXiihSwaXTDsQcmkpnZS9UYIchpmL2+wi LNiqis0y3qhQ2QONXPHjn3y5FzIiQMQwtPjdkzbTD6t2x0wpjanOvsIKFHlq4jMw 6FMBE3VTARU5ig9xBHHuCOMJKW6Lq2RbAvq4MAMIQO+IJWp3s8QSEnaKQMZEElw= =0Fib -----END PGP SIGNATURE----- --qVHblb/y9DPlgkHs--