|WARNING| net/iavf: fix memory leaks in RSS flow engine
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Sat Oct 10 14:43:57 CEST 2026
Test-Label: ai-code-review
Test-Status: WARNING
https://dpdk.org/patch/170997
_AI Code Review_
=== Patch Review: series.patch (via Claude) ===
Review date: 2026-10-10
# DPDK Patch Review
## Errors
**Error 1: Early return does not clean up rss_cfg**
**File:** `drivers/net/intel/iavf/iavf_hash.c`
**Function:** `iavf_hash_destroy()`
**Line:** ~1648 (after changes)
```c
if (ret) {
PMD_DRV_LOG(ERR, "fail to del RSS configure");
rte_flow_error_set(error, -ret,
RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
"Failed to delete rss rule.");
return -rte_errno;
}
```
The error path after `iavf_add_del_rss_cfg()` fails now returns early without freeing `rss_cfg` or clearing `flow->rule`. The patch correctly moved the `rte_free(rss_cfg)` and `flow->rule = NULL` outside the `!vf->vf_reset` conditional, but the early return on error bypasses them, leaking the config.
**Suggested fix:**
```c
if (!vf->vf_reset) {
ret = iavf_add_del_rss_cfg(ad, rss_cfg, false);
if (ret) {
PMD_DRV_LOG(ERR, "fail to del RSS configure");
rte_flow_error_set(error, -ret,
RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
"Failed to delete rss rule.");
ret = -rte_errno;
}
}
flow->rule = NULL;
rte_free(rss_cfg);
return ret;
```
---
## Warnings
None.
---
## Info
**Info 1: Pre-existing NULL check defensive pattern**
**File:** `drivers/net/intel/iavf/iavf_hash.c`
**Function:** `iavf_hash_destroy()`
**Context:** The function unconditionally dereferences `flow->rule` without checking if it is NULL.
This is pre-existing code not introduced by this patch. If `flow->rule` is NULL when `iavf_hash_destroy()` is called, the assignment `rss_cfg = (struct virtchnl_rss_cfg *)flow->rule;` followed by `rte_free(rss_cfg);` will free NULL (which is safe), but the function should handle this defensively or document that callers guarantee `flow->rule` is non-NULL.
Not introduced by this patch.
---
Review-Result: ERROR
More information about the test-report
mailing list