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 88988A0C4B for ; Tue, 13 Jul 2021 03:18:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7BAD6411C9; Tue, 13 Jul 2021 03:18:52 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id C3E904069D; Tue, 13 Jul 2021 03:18:49 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10043"; a="208260579" X-IronPort-AV: E=Sophos;i="5.84,235,1620716400"; d="scan'208";a="208260579" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2021 18:18:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,235,1620716400"; d="scan'208";a="569774116" Received: from npg_dpdk_virtio_jiayuhu_07.sh.intel.com ([10.67.119.25]) by fmsmga001.fm.intel.com with ESMTP; 12 Jul 2021 18:18:47 -0700 From: Jiayu Hu To: dev@dpdk.org Cc: maxime.coquelin@redhat.com, chenbo.xia@intel.com, Jiayu Hu , stable@dpdk.org Date: Tue, 13 Jul 2021 03:46:21 -0400 Message-Id: <1626162383-89674-2-git-send-email-jiayu.hu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1626162383-89674-1-git-send-email-jiayu.hu@intel.com> References: <1625823790-91995-2-git-send-email-jiayu.hu@intel.com> <1626162383-89674-1-git-send-email-jiayu.hu@intel.com> Subject: [dpdk-stable] [PATCH v4 1/3] vhost: fix lock on device readiness notification 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 Sender: "stable" The vhost notifies the application of device readiness via vhost_user_notify_queue_state(), but calling this function is not protected by the lock. This patch is to make this function call lock protected. Fixes: d0fcc38f5fa4 ("vhost: improve device readiness notifications") Cc: stable@dpdk.org Signed-off-by: Jiayu Hu Reviewed-by: Maxime Coquelin --- lib/vhost/vhost_user.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c index 031c578..31300e1 100644 --- a/lib/vhost/vhost_user.c +++ b/lib/vhost/vhost_user.c @@ -2995,9 +2995,6 @@ vhost_user_msg_handler(int vid, int fd) } } - if (unlock_required) - vhost_user_unlock_all_queue_pairs(dev); - /* If message was not handled at this stage, treat it as an error */ if (!handled) { VHOST_LOG_CONFIG(ERR, @@ -3032,6 +3029,8 @@ vhost_user_msg_handler(int vid, int fd) } } + if (unlock_required) + vhost_user_unlock_all_queue_pairs(dev); if (!virtio_is_ready(dev)) goto out; -- 2.7.4