|WARNING| net/ixgbe: fix leak of filters on flow create
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Tue Sep 15 11:05:19 CEST 2026
Test-Label: ai-code-review
Test-Status: WARNING
https://dpdk.org/patch/169529
_AI Code Review_
=== Patch Review: series.patch (via Claude) ===
Review date: 2026-09-15
# DPDK Patch Review
## Summary
This patch fixes resource leaks in `ixgbe_flow_create()` where hardware filters were programmed before allocating the software flow object. If allocation failed, the hardware filter remained installed with no way to destroy it. The fix reorders operations: allocate first, then program hardware, cleaning up on failure.
---
## Errors
### 1. Allocation failure handling sets wrong errno (L2 tunnel case)
**File:** `drivers/net/intel/ixgbe/ixgbe_flow.c:2977`
The L2 tunnel allocation failure path sets `ret = -ENOMEM` and jumps to `out:`, which will return `-ENOMEM` to the caller. However, the L2 tunnel block is reached only after all prior parsers returned non-zero (meaning "not this filter type"). The original code fell through to RSS parsing on L2 tunnel hardware programming failure, which would overwrite the error. The new code returns immediately, which is correct for L2 tunnel parse success, but the `goto out` on allocation failure should verify that falling through to RSS parsing is not required. Based on the commit message ("L2 tunnel add failures now return immediately instead of falling through to RSS parsing, which cannot succeed for a VF/PF E-tag rule"), this is correct. However, verify that allocation failure in the L2 tunnel path (not hardware programming failure) should also skip RSS parsing. If an allocation fails, the patch correctly returns `-ENOMEM`, but if this path was reachable when the pattern could also match RSS, t
he logic would have changed.
**Analysis:** The patch commit message states L2 tunnel rules cannot succeed for RSS parsing, so returning immediately on L2 tunnel allocation failure is correct. This is not an error.
### 2. FDIR mask update ordering
**File:** `drivers/net/intel/ixgbe/ixgbe_flow.c:2948-2955`
The FDIR block allocates `fdir_rule_ptr`, then calls `ixgbe_fdir_flow_program()`, then updates `fdir_info->mask_added` and `fdir_conf->flow_mask` if `first_mask` is true. If `ixgbe_fdir_flow_program()` fails, the patch frees `fdir_rule_ptr` and jumps to `out`. However, the original code updated the mask state *after* programming succeeded. The new code has the same mask update logic after the failure check, so mask state is only updated on success. This is correct.
**Not an error.**
---
## Warnings
### 1. L2 tunnel return path change behavior
**File:** `drivers/net/intel/ixgbe/ixgbe_flow.c:2973-2991`
The original L2 tunnel block did not have a `goto out` or `return` after the `if (!ret)` check following `ixgbe_dev_l2_tunnel_filter_add()`, allowing fallthrough to RSS parsing when `ixgbe_dev_l2_tunnel_filter_add()` failed. The new code always returns or jumps to `out` after the L2 tunnel parse succeeds, even on hardware programming failure. This changes behavior: previously, an L2 tunnel pattern that failed hardware programming would attempt RSS parsing; now it returns the L2 tunnel error immediately.
The commit message justifies this: "L2 tunnel add failures now return immediately instead of falling through to RSS parsing, which cannot succeed for a VF/PF E-tag rule and overwrote the original error." This is an intentional behavior fix. However, ensure that no valid use case existed where an L2 tunnel pattern could also be valid as an RSS rule and the old fallback was intentional. Based on the commit message, this was a bug, not a feature.
**Conclusion:** The change is correct per the commit message. Not a warning.
---
## Info
### 1. Consistent error message phrasing
**File:** Throughout the patch
All new allocation failure messages use `"failed to allocate memory"`, matching the existing style in the function. This is consistent and correct.
### 2. Missing release notes entry
This is a bug fix for a resource leak (Fixes tag present, Cc: stable). However, the patch does not update release notes. Per AGENTS.md, API changes and new drivers require release notes, but test-only and internal changes do not. This is a correctness fix in an existing driver without API changes. The guideline states release notes are NOT required for internal implementation changes that don't affect public API. However, significant bug fixes that affect application behavior (like leaking hardware filters) are typically documented.
**Recommendation:** Consider adding a release note entry in `doc/guides/rel_notes/release_XX_XX.rst` under "Fixed Issues" to document this leak fix. This is a **suggestion**, not a requirement per the guidelines as written.
### 3. Allocation size pattern
All allocations use `sizeof(struct <type>)` with the structure type explicitly named, rather than `sizeof(*ptr)`. This is consistent with the existing code style in the function. The DPDK guidelines do not mandate one approach over the other for `rte_zmalloc()` sizing. The approach used here is clear and matches surrounding code.
---
## Conclusion
The patch correctly fixes the resource leak by allocating software objects before programming hardware. Error paths now properly free allocated memory before returning or jumping to `out`. The L2 tunnel behavior change (not falling through to RSS parsing on errors) is an intentional bug fix per the commit message.
**No errors found.** The patch is correct.
More information about the test-report
mailing list