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 CAD24A04DD for ; Wed, 28 Oct 2020 11:51:41 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C32F5C9F0; Wed, 28 Oct 2020 11:51:40 +0100 (CET) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by dpdk.org (Postfix) with ESMTP id 08F2DC9F0 for ; Wed, 28 Oct 2020 11:51:37 +0100 (CET) Received: by mail-wm1-f67.google.com with SMTP id w23so4094623wmi.4 for ; Wed, 28 Oct 2020 03:51:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eBxmRHNSdAJgrTeat6YKETm8W9dI8UmT1RD56SxLKIA=; b=O7QfA/oj54bUbzLYuR4EHT/fTuRiQzAFl4WpW+TLaSYLiOMb9L03F/FWD7avcEtptT /QQTvyadKuUlN5NI+SwILIQo0j5e/C/dsFi2TkmjeE/6jLdwXwKJmUOdqrviq5p0ahIM SNJ4YzLqjSLJOQ816M7obEwORn3IfrhtFM35Y3R1FBdrxRwhPoxjoWlKPrH07aAPgnlg r3NwM2uCMRALReRkCOSlrPOq19eKbLiUw2sz4pLyCO2hTufadSGp/8pMOQTY3+Uq4Cie izfXeAPCY2/d2xkcY7udC8Vu+xLIg/65a7rxVGU9YqgFXUWxvp4qptyYwfItoeaySvrb xhsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eBxmRHNSdAJgrTeat6YKETm8W9dI8UmT1RD56SxLKIA=; b=izycXyjzdObM6wONHubI6bclje7u2KXzUOpOLJGjxjpQFZabJ2focwo04L/KkYFg0W Gxzh37VuiS8n03cHGGgyhMhqlqM1kvcxilUwgDrO2u+RAFVnsX8U5IcnWEEryej8gtC0 djc81URXgJK97C6ZZjH6/AvmOcMt3SqjqZS/Tm+73xr1SVDG9CSYfPukLTkHYks+atrI /sQb9cynNZP2Dh7Yhy57Gay5+W/NCBkXDHcQlGG5/sPN4qFg3uA2203FJZgNEj42m0o7 CLugbrqYA9kbqKFwl6+shLEIVMyymEs7YmdLB4OgBo1esaMAUKbjOwwSVkS1oEYTIa1a fFaA== X-Gm-Message-State: AOAM532peYMClg2WDJqHj2GrSIn+7e/be3SdrRAini3SmweHay/uVb7P H+Cs40fr19GNzcHEbolTaEI= X-Google-Smtp-Source: ABdhPJwnHIMIpFFkrMcr4WpdVcDV/+rsLI2vunRy0sMhkbaVEKoDmaRlA1rDkX/aaSA1GF3RjknRqQ== X-Received: by 2002:a1c:de8a:: with SMTP id v132mr7315618wmg.173.1603882296747; Wed, 28 Oct 2020 03:51:36 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id x6sm6312778wmb.17.2020.10.28.03.51.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 03:51:36 -0700 (PDT) From: luca.boccassi@gmail.com To: Yunjian Wang Cc: Anatoly Burakov , dpdk stable Date: Wed, 28 Oct 2020 10:44:22 +0000 Message-Id: <20201028104606.3504127-103-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201028104606.3504127-1-luca.boccassi@gmail.com> References: <20201028104606.3504127-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'bus/pci: fix leak on VFIO mapping error' has been queued to stable release 19.11.6 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" Hi, FYI, your patch has been queued to stable release 19.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 10/30/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From 6fb58ea15dbb2e1edd1ffa1217fc58f044ed3d6d Mon Sep 17 00:00:00 2001 From: Yunjian Wang Date: Fri, 11 Sep 2020 19:08:04 +0800 Subject: [PATCH] bus/pci: fix leak on VFIO mapping error [ upstream commit 2a089d2d52f45bca6f179345fa3f3abe1a0e2ea9 ] Currently, only the 'vfio_dev_fd' is closed in failure path, so some resources are not released(such as 'vfio_group_fd'). The rte_vfio_release_device() should be used to avoid this problem. Fixes: 33604c31354a ("vfio: refactor PCI BAR mapping") Signed-off-by: Yunjian Wang Reviewed-by: Anatoly Burakov --- drivers/bus/pci/linux/pci_vfio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c index 5dcf15424c..a0bb1f5fd3 100644 --- a/drivers/bus/pci/linux/pci_vfio.c +++ b/drivers/bus/pci/linux/pci_vfio.c @@ -826,7 +826,8 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev) err_vfio_res: rte_free(vfio_res); err_vfio_dev_fd: - close(vfio_dev_fd); + rte_vfio_release_device(rte_pci_get_sysfs_path(), + pci_addr, vfio_dev_fd); return -1; } @@ -894,7 +895,8 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev) return 0; err_vfio_dev_fd: - close(vfio_dev_fd); + rte_vfio_release_device(rte_pci_get_sysfs_path(), + pci_addr, vfio_dev_fd); return -1; } -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-10-28 10:35:14.976545325 +0000 +++ 0103-bus-pci-fix-leak-on-VFIO-mapping-error.patch 2020-10-28 10:35:11.656832261 +0000 @@ -1,14 +1,15 @@ -From 2a089d2d52f45bca6f179345fa3f3abe1a0e2ea9 Mon Sep 17 00:00:00 2001 +From 6fb58ea15dbb2e1edd1ffa1217fc58f044ed3d6d Mon Sep 17 00:00:00 2001 From: Yunjian Wang Date: Fri, 11 Sep 2020 19:08:04 +0800 Subject: [PATCH] bus/pci: fix leak on VFIO mapping error +[ upstream commit 2a089d2d52f45bca6f179345fa3f3abe1a0e2ea9 ] + Currently, only the 'vfio_dev_fd' is closed in failure path, so some resources are not released(such as 'vfio_group_fd'). The rte_vfio_release_device() should be used to avoid this problem. Fixes: 33604c31354a ("vfio: refactor PCI BAR mapping") -Cc: stable@dpdk.org Signed-off-by: Yunjian Wang Reviewed-by: Anatoly Burakov @@ -17,10 +18,10 @@ 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c -index 940ebc1e35..ef4f72017f 100644 +index 5dcf15424c..a0bb1f5fd3 100644 --- a/drivers/bus/pci/linux/pci_vfio.c +++ b/drivers/bus/pci/linux/pci_vfio.c -@@ -838,7 +838,8 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev) +@@ -826,7 +826,8 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev) err_vfio_res: rte_free(vfio_res); err_vfio_dev_fd: @@ -30,7 +31,7 @@ return -1; } -@@ -906,7 +907,8 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev) +@@ -894,7 +895,8 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev) return 0; err_vfio_dev_fd: