diff mbox series

[1/2] net/failsafe: fix freeing after device release

Message ID dc123dc637a2f2b32d33a542bcf993c046f2db5c.1654516650.git.wangyunjian@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: Andrew Rybchenko
Headers show
Series fixes for failsafe/tap | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

wangyunjian June 7, 2022, 6:50 a.m. UTC
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 mbox series

Patch

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;
 }