From: wangyunjian <wangyunjian@huawei.com>
To: <dev@dpdk.org>
Cc: <matan@nvidia.com>, <shahafs@nvidia.com>,
<viacheslavo@nvidia.com>, <dingxiaoxiong@huawei.com>,
Yunjian Wang <wangyunjian@huawei.com>, <stable@dpdk.org>
Subject: [dpdk-stable] [dpdk-dev] [PATCH] net/mlx5: fix use after free in mlx5_dma_unmap
Date: Sat, 10 Jul 2021 18:35:22 +0800 [thread overview]
Message-ID: <cdb08954493d44155cf04fd813cfd3a41255bd4c.1625909056.git.wangyunjian@huawei.com> (raw)
From: Yunjian Wang <wangyunjian@huawei.com>
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 <wangyunjian@huawei.com>
---
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
next reply other threads:[~2021-07-10 10:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-10 10:35 wangyunjian [this message]
2021-07-22 14:10 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cdb08954493d44155cf04fd813cfd3a41255bd4c.1625909056.git.wangyunjian@huawei.com \
--to=wangyunjian@huawei.com \
--cc=dev@dpdk.org \
--cc=dingxiaoxiong@huawei.com \
--cc=matan@nvidia.com \
--cc=shahafs@nvidia.com \
--cc=stable@dpdk.org \
--cc=viacheslavo@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).