Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by Changyul Lee
Thu, 19 Nov 2026 01:44
[PATCH iwl-net] ice: protect VF lifetime during LLDP configuration
Author: Changyul Lee
Date: Thu, 19 Nov 2026 01:44
Date: Thu, 19 Nov 2026 01:44
65 lines
12917 bytes
12917 bytes
ice_free_vfs() can free a VF or its VSI while ice_cfg_sw_rx_lldp()
is configuring LLDP. Taking table_lock here would reverse the lock
order because ethtool already holds RTNL and ice_free_vfs() takes
RTNL under table_lock.
Look up each VF by ID to hold a reference. Hold the VF's cfg_lock
while configuring its VSI to prevent ice_free_vfs() from releasing
the VSI during configuration.
Fixes: 2296345416b0 ("ice: receive LLDP on trusted VFs")
Signed-off-by: Changyul Lee <lcy8047@gmail.com>
---
Found with a static analysis tool we are developing.
Compile-tested only, with x86_64_defconfig plus PCI_IOV, ICE, DCB and
W=1.
Taking cfg_lock under RTNL follows the order set by commit ae82ccd68774
("ice: attach and detach VF representors outside of vf->cfg_lock") in
dev-queue.
drivers/net/ethernet/intel/ice/ice_lib.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
index 773a656ba92e..4068a1aac8e8 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -2207,7 +2207,6 @@ void ice_cfg_sw_rx_lldp(struct ice_pf *pf, bool enable)
{
struct ice_vsi *vsi;
struct ice_vf *vf;
- unsigned int bkt;
vsi = ice_get_main_vsi(pf);
ice_vsi_cfg_sw_lldp(vsi, false, enable);
@@ -2215,14 +2214,18 @@ void ice_cfg_sw_rx_lldp(struct ice_pf *pf, bool enable)
if (!test_bit(ICE_FLAG_SRIOV_ENA, pf->flags))
return;
- ice_for_each_vf(pf, bkt, vf) {
- vsi = ice_get_vf_vsi(vf);
-
- if (WARN_ON(!vsi))
+ for (u16 vf_id = 0; vf_id < pf->vfs.num_supported; vf_id++) {
+ vf = ice_get_vf_by_id(pf, vf_id);
+ if (!vf)
continue;
- if (ice_vf_is_lldp_ena(vf))
+ mutex_lock(&vf->cfg_lock);
+ vsi = ice_get_vf_vsi(vf);
+ if (vsi && ice_vf_is_lldp_ena(vf))
ice_vsi_cfg_sw_lldp(vsi, false, enable);
+ mutex_unlock(&vf->cfg_lock);
+
+ ice_put_vf(vf);
}
}
base-commit: c2c187fd5fa667cedb0b946f5f7a5099fb8e8402
--
2.43.0
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads