[PATCH v2 8/9] net/ixgbe: fix VF use after free in interrupt handler

Anurag Mandal anurag.mandal at intel.com
Tue Dec 1 11:55:19 CET 2026


The VF interrupt handler reports a PF reset with
RTE_ETH_EVENT_INTR_RESET and then keeps using the
device: it clears the mailbox flag in the private
data and re-enables the interrupts.
An application may close or detach the port from
the event callback, which releases the port and
frees its private data, so the handler then
accesses freed memory.

Report the event only once the handler is done
with the device.
As a result, interrupts are re-enabled before
the callback runs instead of after it.

Fixes: 77234603fba0 ("net/ixgbe: support VF mailbox interrupt for link up/down")
Cc: stable at dpdk.org

Signed-off-by: Anurag Mandal <anurag.mandal at intel.com>
---
 drivers/net/intel/ixgbe/ixgbe_ethdev.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/net/intel/ixgbe/ixgbe_ethdev.c b/drivers/net/intel/ixgbe/ixgbe_ethdev.c
index 4181bbcd17..003fe32891 100644
--- a/drivers/net/intel/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/intel/ixgbe/ixgbe_ethdev.c
@@ -7714,7 +7714,8 @@ ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev)
 	return ret;
 }
 
-static void ixgbevf_mbx_process(struct rte_eth_dev *dev)
+/* return true if the PF requested a VF reset */
+static bool ixgbevf_mbx_process(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	u32 in_msg = 0;
@@ -7726,10 +7727,11 @@ static void ixgbevf_mbx_process(struct rte_eth_dev *dev)
 	if (in_msg == IXGBE_PF_CONTROL_MSG) {
 		/* dummy mbx read to ack pf */
 		if (ixgbe_read_mbx(hw, &in_msg, 1, 0))
-			return;
-		rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET,
-					     NULL);
+			return false;
+		return true;
 	}
+
+	return false;
 }
 
 static int
@@ -7753,20 +7755,21 @@ ixgbevf_dev_interrupt_get_status(struct rte_eth_dev *dev)
 	return 0;
 }
 
-static int
+static bool
 ixgbevf_dev_interrupt_action(struct rte_eth_dev *dev)
 {
 	struct ixgbe_interrupt *intr =
 		IXGBE_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
+	bool pf_reset = false;
 
 	if (intr->flags & IXGBE_FLAG_MAILBOX) {
-		ixgbevf_mbx_process(dev);
+		pf_reset = ixgbevf_mbx_process(dev);
 		intr->flags &= ~IXGBE_FLAG_MAILBOX;
 	}
 
 	ixgbevf_intr_enable(dev);
 
-	return 0;
+	return pf_reset;
 }
 
 static void
@@ -7775,7 +7778,10 @@ ixgbevf_dev_interrupt_handler(void *param)
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 
 	ixgbevf_dev_interrupt_get_status(dev);
-	ixgbevf_dev_interrupt_action(dev);
+	/* the callback may close and free the port, so it must come last */
+	if (ixgbevf_dev_interrupt_action(dev))
+		rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET,
+					     NULL);
 }
 
 /**
-- 
2.25.1



More information about the stable mailing list