Skip to content

Commit

Permalink
net/txgbe: fix use-after-free on remove
Browse files Browse the repository at this point in the history
[ upstream commit 0105788ebac6c796f30361912377550207084a17 ]

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: e0d876e ("net/txgbe: support device stop and close")

Reported-by: Pengfei Sun <sunpengfei16@huawei.com>
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Jiawen Wu <jiawenwu@trustnetic.com>
  • Loading branch information
wyjwang authored and kevintraynor committed Jul 11, 2023
1 parent 6de921b commit 80e17cb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/txgbe/txgbe_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2009,8 +2009,9 @@ 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_setup_link_alarm_handler, dev);

/* uninitialize PF if max_vfs not zero */
txgbe_pf_host_uninit(dev);
Expand Down

0 comments on commit 80e17cb

Please sign in to comment.