From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C0C5AA0352 for ; Mon, 4 Nov 2019 18:41:38 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 87F29322C; Mon, 4 Nov 2019 18:41:38 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id BC6782BF9; Mon, 4 Nov 2019 18:41:34 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Nov 2019 09:41:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,267,1569308400"; d="scan'208";a="195523472" Received: from silpixa00399498.ir.intel.com (HELO silpixa00399498.ger.corp.intel.com) ([10.237.223.151]) by orsmga008.jf.intel.com with ESMTP; 04 Nov 2019 09:41:31 -0800 From: Anatoly Burakov To: dev@dpdk.org Cc: damarion@cisco.com, thomas@monjalon.net, david.marchand@redhat.com, dariuszx.stojaczyk@intel.com, stable@dpdk.org Date: Mon, 4 Nov 2019 17:41:33 +0000 Message-Id: <9bfc4c6d563f29ca4ef5cca80e650928e51e5514.1572889140.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-stable] [PATCH] vfio: fix getting default container X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 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" When requesting DMA mapping to default container, we are meant to supply the RTE_VFIO_DEFAULT_CONTAINER_FD value, however this is not handled correctly by get_vfio_cfg_by_container_fd(), because it only looks at actual fd values and does not check for this special case. Fix it to return default container if the fd requested is the special RTE_VFIO_DEFAULT_CONTAINER_FD value. Fixes: 4f5519ed8349 ("vfio: cleanup getting group fd") Cc: dariuszx.stojaczyk@intel.com Cc: stable@dpdk.org Signed-off-by: Anatoly Burakov --- lib/librte_eal/linux/eal/eal_vfio.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/librte_eal/linux/eal/eal_vfio.c b/lib/librte_eal/linux/eal/eal_vfio.c index d9541b1220..d7887388f9 100644 --- a/lib/librte_eal/linux/eal/eal_vfio.c +++ b/lib/librte_eal/linux/eal/eal_vfio.c @@ -412,6 +412,9 @@ get_vfio_cfg_by_container_fd(int container_fd) { int i; + if (container_fd == RTE_VFIO_DEFAULT_CONTAINER_FD) + return default_vfio_cfg; + for (i = 0; i < VFIO_MAX_CONTAINERS; i++) { if (vfio_cfgs[i].vfio_container_fd == container_fd) return &vfio_cfgs[i]; -- 2.17.1