patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Yunjian Wang <wangyunjian@huawei.com>
To: <dev@dpdk.org>
Cc: <jiawenwu@trustnetic.com>, <jianwang@trustnetic.com>,
	<luyicai@huawei.com>, Yunjian Wang <wangyunjian@huawei.com>,
	<stable@dpdk.org>
Subject: [dpdk-dev] [PATCH 1/1] net/txgbe: fix use-after-free on remove
Date: Thu, 18 May 2023 15:11:24 +0800	[thread overview]
Message-ID: <06a89892aa1b37996e5e629b3488c59d565393bd.1684393730.git.wangyunjian@huawei.com> (raw)

When cleaning up NIC's interrupts, it is possible to add some alarms
at the same time. However, if these alarms are not canceled, it may
cause use-after-free problems. Therefore, after cleaning up NIC's
interrupts, these alarms should also be canceled.

Fixes: d3bb4a04eac1 ("net/txgbe: add SFP hotplug identification")
Fixes: e0d876ef6bbc ("net/txgbe: support device stop and close")
Cc: stable@dpdk.org

Reported-by: Pengfei Sun <sunpengfei16@huawei.com>
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 drivers/net/txgbe/txgbe_ethdev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c
index a502618bc5..a3d7461951 100644
--- a/drivers/net/txgbe/txgbe_ethdev.c
+++ b/drivers/net/txgbe/txgbe_ethdev.c
@@ -2032,8 +2032,10 @@ txgbe_dev_close(struct rte_eth_dev *dev)
 		rte_delay_ms(100);
 	} while (retries++ < (10 + TXGBE_LINK_UP_TIME));
 
-	/* cancel the delay handler before remove dev */
+	/* cancel all alarm handler before remove dev */
 	rte_eal_alarm_cancel(txgbe_dev_interrupt_delayed_handler, dev);
+	rte_eal_alarm_cancel(txgbe_dev_detect_sfp, dev);
+	rte_eal_alarm_cancel(txgbe_dev_setup_link_alarm_handler, dev);
 
 	/* uninitialize PF if max_vfs not zero */
 	txgbe_pf_host_uninit(dev);
-- 
2.33.0


             reply	other threads:[~2023-05-18  7:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-18  7:11 Yunjian Wang [this message]
2023-05-18  7:46 ` Jiawen Wu
2023-05-18 17:49   ` Ferruh Yigit

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=06a89892aa1b37996e5e629b3488c59d565393bd.1684393730.git.wangyunjian@huawei.com \
    --to=wangyunjian@huawei.com \
    --cc=dev@dpdk.org \
    --cc=jianwang@trustnetic.com \
    --cc=jiawenwu@trustnetic.com \
    --cc=luyicai@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 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).