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 C95D3A0A0C for ; Sat, 10 Jul 2021 12:35:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 95D9840DDB; Sat, 10 Jul 2021 12:35:33 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 2B40340DDB; Sat, 10 Jul 2021 12:35:31 +0200 (CEST) Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4GMRDH0VCPzbbbL; Sat, 10 Jul 2021 18:32:15 +0800 (CST) Received: from dggpemm500008.china.huawei.com (7.185.36.136) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Sat, 10 Jul 2021 18:35:29 +0800 Received: from localhost (10.174.242.204) by dggpemm500008.china.huawei.com (7.185.36.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Sat, 10 Jul 2021 18:35:28 +0800 From: wangyunjian To: CC: , , , , Yunjian Wang , Date: Sat, 10 Jul 2021 18:35:22 +0800 Message-ID: X-Mailer: git-send-email 1.9.5.msysgit.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.242.204] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500008.china.huawei.com (7.185.36.136) X-CFilter-Loop: Reflected Subject: [dpdk-stable] [dpdk-dev] [PATCH] net/mlx5: fix use after free in mlx5_dma_unmap 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" From: Yunjian Wang This patch fixes the use-after-free bug which was reported by Coverity Scan in the mlx5_dma_unmap function. Coverity issue: 371679 Fixes: 992e6df3dafe ("common/mlx5: free MR resource on device DMA unmap") Cc: stable@dpdk.org Signed-off-by: Yunjian Wang --- drivers/net/mlx5/mlx5_mr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c index 89c43fc9e9..e87f138564 100644 --- a/drivers/net/mlx5/mlx5_mr.c +++ b/drivers/net/mlx5/mlx5_mr.c @@ -315,9 +315,9 @@ mlx5_dma_unmap(struct rte_pci_device *pdev, void *addr, return -1; } LIST_REMOVE(mr, mr); - mlx5_mr_free(mr, sh->share_cache.dereg_mr_cb); DRV_LOG(DEBUG, "port %u remove MR(%p) from list", dev->data->port_id, (void *)mr); + mlx5_mr_free(mr, sh->share_cache.dereg_mr_cb); mlx5_mr_rebuild_cache(&sh->share_cache); /* * No explicit wmb is needed after updating dev_gen due to -- 2.23.0