From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D392B43B79 for ; Thu, 7 Mar 2024 09:06:22 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CE33240A6D; Thu, 7 Mar 2024 09:06:22 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id E823F402F2 for ; Thu, 7 Mar 2024 09:06:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709798781; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2NSPq5stsDA4CN28ODm00oEeIJqGDDCzoHxgaGfhpmI=; b=ggamdtUWSHyuEptn/So7stkeKJUGbqddSRhxqRGFiQmU0QYPo/LnKq5wohZ5YKdeBLyHkf q0Y8/yfOF/eOgFq07IwAak8iGUupYXgrgZe2u7TwlORafXG8G+rbEdaMnIslBXij1DB7IY +gteq7kyMVHGcplkq/VX4/m16SG4gR8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-624-xqQmwW-TO9SxO54Dbd31rQ-1; Thu, 07 Mar 2024 03:06:18 -0500 X-MC-Unique: xqQmwW-TO9SxO54Dbd31rQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C62A2101A523; Thu, 7 Mar 2024 08:06:17 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.225.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id A70371C05E1C; Thu, 7 Mar 2024 08:06:16 +0000 (UTC) From: David Marchand To: stable@dpdk.org Cc: luca.boccassi@gmail.com, Eelco Chaudron , Maxime Coquelin Subject: [PATCH 22.11] vhost: fix virtqueue access check in vhost-user setup Date: Thu, 7 Mar 2024 09:06:04 +0100 Message-ID: <20240307080604.4028280-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org [ upstream commit b3e42d92362bcc75df21c5b86ba7c0685b40a3bf ] Calling vring_invalidate must be done with a (write) lock taken on the virtqueue. Fixes: 72d002b3ebda ("vhost: fix vring address handling during live migration") Signed-off-by: David Marchand Acked-by: Eelco Chaudron Reviewed-by: Maxime Coquelin --- lib/vhost/vhost_user.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c index 8df66e68b3..66ab68fa56 100644 --- a/lib/vhost/vhost_user.c +++ b/lib/vhost/vhost_user.c @@ -2144,7 +2144,9 @@ vhost_user_get_vring_base(struct virtio_net **pdev, vhost_user_iotlb_flush_all(vq); + rte_spinlock_lock(&vq->access_lock); vring_invalidate(dev, vq); + rte_spinlock_unlock(&vq->access_lock); return RTE_VHOST_MSG_RESULT_REPLY; } -- 2.43.0