All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yunjian Wang <wangyunjian@huawei.com>
To: <dev@dpdk.org>
Cc: <grive@u256.net>, <hkalra@marvell.com>,
	<huangshaozhang@huawei.com>,
	Yunjian Wang <wangyunjian@huawei.com>, <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH 1/2] net/failsafe: fix freeing after device release
Date: Tue, 7 Jun 2022 14:50:49 +0800	[thread overview]
Message-ID: <dc123dc637a2f2b32d33a542bcf993c046f2db5c.1654516650.git.wangyunjian@huawei.com> (raw)
In-Reply-To: <cover.1654516650.git.wangyunjian@huawei.com>

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


  reply	other threads:[~2022-06-07  6:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-07  6:49 [dpdk-dev] [PATCH 0/2] fixes for failsafe/tap Yunjian Wang
2022-06-07  6:50 ` Yunjian Wang [this message]
2022-06-07  6:50 ` [dpdk-dev] [PATCH 2/2] net/tap: fix use after free on error path Yunjian Wang
2022-06-08 12:43 ` [dpdk-dev] [PATCH 0/2] fixes for failsafe/tap Andrew Rybchenko

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=dc123dc637a2f2b32d33a542bcf993c046f2db5c.1654516650.git.wangyunjian@huawei.com \
    --to=wangyunjian@huawei.com \
    --cc=dev@dpdk.org \
    --cc=grive@u256.net \
    --cc=hkalra@marvell.com \
    --cc=huangshaozhang@huawei.com \
    --cc=stable@dpdk.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.