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 818EDA0A0C for ; Fri, 9 Jul 2021 05:15:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6EF3E4166B; Fri, 9 Jul 2021 05:15:26 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 69D0D4165A; Fri, 9 Jul 2021 05:15:22 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10039"; a="209454927" X-IronPort-AV: E=Sophos;i="5.84,225,1620716400"; d="scan'208";a="209454927" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jul 2021 20:15:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,225,1620716400"; d="scan'208";a="428606871" Received: from npg_dpdk_virtio_jiayuhu_07.sh.intel.com ([10.67.119.25]) by orsmga002.jf.intel.com with ESMTP; 08 Jul 2021 20:15:19 -0700 From: Jiayu Hu To: dev@dpdk.org Cc: maxime.coquelin@redhat.com, chenbo.xia@intel.com, yinan.wang@intel.com, Jiayu Hu , stable@dpdk.org Date: Fri, 9 Jul 2021 05:43:08 -0400 Message-Id: <1625823790-91995-2-git-send-email-jiayu.hu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1625823790-91995-1-git-send-email-jiayu.hu@intel.com> References: <1625656687-40604-2-git-send-email-jiayu.hu@intel.com> <1625823790-91995-1-git-send-email-jiayu.hu@intel.com> Subject: [dpdk-stable] [PATCH v3 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