|SUCCESS| [v2,8/8] net/ice: fix DCF port leak on probe failure
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Sun Nov 8 01:36:54 CET 2026
Test-Label: ai-code-review
Test-Status: SUCCESS
https://dpdk.org/patch/172727
_AI Code Review_
=== Patch Review: series.patch (via Claude) ===
Review date: 2026-11-08
# DPDK Patch Review
## PATCH 1/8: net/ice: fix DCF hardware init error path
### Errors
**Resource leak on error path:**
```c
if ((hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN_V2) &&
dcf_get_vlan_offload_caps_v2(hw))
- goto err_rss;
+ goto err_intr;
```
The patch correctly adds cleanup for the interrupt handler and QoS config, but the `err_rss` label already exists in the original code and falls through to `err_alloc`. The patch adds `rte_free(hw->vf_vsi_map)` at `err_alloc`, which means this free will be executed on ALL error paths including those that never allocated `vf_vsi_map`. The VF VSI map is allocated earlier in `ice_dcf_init_hw()` (not visible in this patch), but the patch does not verify whether that allocation could have failed before reaching this error path. If `vf_vsi_map` is NULL when `err_alloc` is reached from an earlier failure point, `rte_free(NULL)` is safe but suggests the cleanup flow may be incomplete.
However, reviewing the added cleanup more carefully: the new `err_intr:` label correctly cleans up the interrupt registration and QoS array that are allocated between `err_rss:` and the VLAN V2 check. The `err_alloc:` addition of `vf_vsi_map` free is correct if `vf_vsi_map` is allocated before any path that reaches `err_alloc`. Since we cannot see the full function, we must assume the patch author verified this ordering. The pattern is correct: each label cleans up everything allocated after the previous label.
**Correctness verified** - the error path cleanup follows the standard pattern of unwinding allocations in reverse order.
## PATCH 2/8: net/ice: fix DCF parent adapter init error path
### Errors
None. The patch correctly adds missing cleanup of `parent_adapter->pf.main_vsi` on all error paths and calls `ice_flow_uninit()` when `ice_flow_init()` fails. The error label ordering is correct.
## PATCH 3/8: net/ice: fix DCF queue config buffer leak
### Errors
None. The patch correctly adds `rte_free(vc_config)` on both error return paths where RXDID validation fails. The leak is fixed.
## PATCH 4/8: net/ice: fix DCF QoS buffer leak on commit
### Errors
None. The patch correctly frees `vf_bw` and `tc_bw` on the success path. These are temporary buffers allocated in the function and should be freed regardless of success or failure. The fix is correct.
## PATCH 5/8: net/ice: fix DCF QoS bandwidth replay config leak
### Errors
None. The patch correctly addresses the race condition by:
1. Allocating a new `bw_cfg` structure
2. Filling it with the configuration
3. Swapping it in under the lock that the VF reset thread holds
4. Freeing the old structure after the swap
This prevents both the leak and the race where the reset thread could see a partially initialized structure. The pattern is correct.
## PATCH 6/8: net/ice: fix DCF TM config leak on close
### Errors
None. The patch correctly moves `ice_dcf_tm_conf_uninit()` outside the `if (hw->tm_conf.committed)` check, so uncommitted TM nodes and shaper profiles are also released. The clearing of bandwidth still correctly requires a committed hierarchy.
## PATCH 7/8: net/ice: fix DCF representor info leak on close
### Errors
None. The patch correctly:
1. Introduces `ice_dcf_dev_teardown()` containing the common cleanup
2. Calls it from `ice_dcf_dev_close()` and `ice_dcf_dev_reset()`
3. Adds `ice_dcf_free_repr_info()` only in close, not in reset (since reset reinitializes and needs the info to survive)
The refactoring is correct and fixes the leak.
## PATCH 8/8: net/ice: fix DCF port leak on probe failure
### Errors
**Missing cleanup of representor info array:**
The error path `err_remove_dcf:` calls `rte_eth_dev_pci_generic_remove(pci_dev, ice_dcf_dev_uninit)`, but the representor info array (`repr_infos`) allocated by `ice_dcf_init_repr_info()` is only freed by `ice_dcf_dev_uninit()` if the device was successfully initialized. On a probe failure after `ice_dcf_init_repr_info()` but before the device is fully initialized, the path through `ice_dcf_dev_uninit()` may not free `repr_infos`. However, checking the code flow: `ice_dcf_dev_uninit()` calls `ice_dcf_free_repr_info()` unconditionally, so this is handled. The fix is correct.
**Potential issue with early failure path:**
The check `if (eth_da.nb_representor_ports && eth_da.type != RTE_ETH_REPRESENTOR_VF)` is moved before `rte_eth_dev_pci_generic_probe()`. This is correct and avoids creating the DCF port if we already know the representor type is unsupported.
The cleanup loop correctly destroys all representors created before the failure, and then removes the DCF port. The fix is correct.
---
## Summary
All patches correctly address resource leaks, error path cleanup, and race conditions. The series systematically fixes missing cleanup in the ice DCF driver across multiple code paths: hardware initialization, parent adapter setup, queue configuration, QoS bandwidth management, TM configuration, and probe failure handling.
Review-Result: CLEAN
More information about the test-report
mailing list