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 40CBBA04FF; Thu, 24 Mar 2022 13:46:57 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4E2E84282E; Thu, 24 Mar 2022 13:46:52 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 7482842827 for ; Thu, 24 Mar 2022 13:46:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1648126009; 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: in-reply-to:in-reply-to:references:references; bh=4bf8uosmLKHCLADwqQPWfAZxpqnw/g+ULBxKQhabhaI=; b=N57vh0Mq/pEC8zqE5TxVXX505+zlO9maDtxZmbXDZTnW9aM0RPI8PJ/pkQk2IyW0yNWL8p sWHAdDZM/u5F2eiQIF7ECsK+6cSWGj4CXN2qJiS50hN0/jt5uNtpGuWcoDdWrXbHs3rUia bV3IC+IZBjIEqyBDu9bLHpBfisStnuw= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-235-29k-N8ApOuO4ca-9gAUsWQ-1; Thu, 24 Mar 2022 08:46:46 -0400 X-MC-Unique: 29k-N8ApOuO4ca-9gAUsWQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 737921C0EDCA; Thu, 24 Mar 2022 12:46:45 +0000 (UTC) Received: from max-t490s.redhat.com (unknown [10.39.208.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id 53D0840CF8F7; Thu, 24 Mar 2022 12:46:44 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, chenbo.xia@intel.com, david.marchand@redhat.com, i.maximets@ovn.org Cc: Maxime Coquelin , stable@dpdk.org Subject: [PATCH v2 1/5] vhost: fix missing virtqueue lock protection Date: Thu, 24 Mar 2022 13:46:34 +0100 Message-Id: <20220324124638.32672-2-maxime.coquelin@redhat.com> In-Reply-To: <20220324124638.32672-1-maxime.coquelin@redhat.com> References: <20220324124638.32672-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com 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: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This patch ensures virtqueue metadata are not being modified while rte_vhost_vring_call() is executed. Fixes: 6c299bb7322f ("vhost: introduce vring call API") Cc: stable@dpdk.org Signed-off-by: Maxime Coquelin --- lib/vhost/vhost.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c index bc88148347..2f96a28dac 100644 --- a/lib/vhost/vhost.c +++ b/lib/vhost/vhost.c @@ -1291,11 +1291,15 @@ rte_vhost_vring_call(int vid, uint16_t vring_idx) if (!vq) return -1; + rte_spinlock_lock(&vq->access_lock); + if (vq_is_packed(dev)) vhost_vring_call_packed(dev, vq); else vhost_vring_call_split(dev, vq); + rte_spinlock_unlock(&vq->access_lock); + return 0; } -- 2.35.1