* [dpdk-dev] [PATCH 1/2] net/failsafe: fix freeing after device release
[not found] <cover.1654516650.git.wangyunjian@huawei.com>
@ 2022-06-07 6:50 ` Yunjian Wang
2022-06-07 6:50 ` [dpdk-dev] [PATCH 2/2] net/tap: fix use after free on error path Yunjian Wang
1 sibling, 0 replies; 2+ messages in thread
From: Yunjian Wang @ 2022-06-07 6:50 UTC (permalink / raw)
To: dev; +Cc: grive, hkalra, huangshaozhang, Yunjian Wang, stable
The PMD destroy function was calling the release function, which frees
dev->data->dev_private, and then tries to free PRIV(dev)->intr_handle,
which causes the heap use after free issue.
The free can be moved to before the release function is called.
Fixes: d61138d4f0e ("drivers: remove direct access to interrupt handle")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
drivers/net/failsafe/failsafe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 3c754a5f66..05cf533896 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -308,8 +308,8 @@ fs_rte_eth_free(const char *name)
if (dev == NULL)
return 0; /* port already released */
ret = failsafe_eth_dev_close(dev);
- rte_eth_dev_release_port(dev);
rte_intr_instance_free(PRIV(dev)->intr_handle);
+ rte_eth_dev_release_port(dev);
return ret;
}
--
2.27.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* [dpdk-dev] [PATCH 2/2] net/tap: fix use after free on error path
[not found] <cover.1654516650.git.wangyunjian@huawei.com>
2022-06-07 6:50 ` [dpdk-dev] [PATCH 1/2] net/failsafe: fix freeing after device release Yunjian Wang
@ 2022-06-07 6:50 ` Yunjian Wang
1 sibling, 0 replies; 2+ messages in thread
From: Yunjian Wang @ 2022-06-07 6:50 UTC (permalink / raw)
To: dev; +Cc: grive, hkalra, huangshaozhang, Yunjian Wang, stable, Xiangjun Meng
The error path was calling rte_eth_dev_release_port() function,
which frees eth_dev->data->dev_private, and then tries to free
pmd->intr_handle, which causes the use after free issue.
The free can be moved to before the release function is called.
Fixes: d61138d4f0e ("drivers: remove direct access to interrupt handle")
Cc: stable@dpdk.org
Signed-off-by: Xiangjun Meng <mengxiangjun4@huawei.com>
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
drivers/net/tap/rte_eth_tap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 5495818be6..9e1032fe72 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -2179,8 +2179,8 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name,
close(pmd->ioctl_sock);
/* mac_addrs must not be freed alone because part of dev_private */
dev->data->mac_addrs = NULL;
- rte_eth_dev_release_port(dev);
rte_intr_instance_free(pmd->intr_handle);
+ rte_eth_dev_release_port(dev);
error_exit_nodev:
TAP_LOG(ERR, "%s Unable to initialize %s",
--
2.27.0
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-06-07 6:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <cover.1654516650.git.wangyunjian@huawei.com>
2022-06-07 6:50 ` [dpdk-dev] [PATCH 1/2] net/failsafe: fix freeing after device release Yunjian Wang
2022-06-07 6:50 ` [dpdk-dev] [PATCH 2/2] net/tap: fix use after free on error path Yunjian Wang
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).