|WARNING| [v3,3/3] net/xsc: rename jumbo buffer fields
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Tue Nov 17 08:07:36 CET 2026
Test-Label: ai-code-review
Test-Status: WARNING
https://dpdk.org/patch/172941
_AI Code Review_
=== Patch Review: series.patch (via Claude) ===
Review date: 2026-11-17
Patch 1/3 (net/xsc: fix jumbo buffer allocation and leak)
Error: The jumbo buffer is freed on every per-port close, not only when the hardware is torn down.
```
if (repr_id == xdev->num_repr_ports - 1)
ret = xdev->dev_ops->dev_close(xdev);
/* Removal closes the device again, do not free it twice. */
rte_free(xdev->jumbo_buffer_pa);
xdev->jumbo_buffer_pa = NULL;
```
The `repr_id == xdev->num_repr_ports - 1` test shows that `xdev` is shared across representor ports. Only the last close actually stops the device through `dev_ops->dev_close()`. The `rte_free()` sits outside that `if`, so closing any representor frees the buffer.
Why it matters:
- The other ports' Rx WQEs still hold the buffer's IOVA in `seg_next->va`, and the hardware is still running.
- Any oversized frame on those queues then DMAs into freed hugepage memory.
- Because the pointer is reset to NULL, the next queue start on another port allocates a second buffer. Older WQEs still point at the stale one.
Separately, the buffer is freed even when `dev_close()` returns an error. That contradicts the commit message's "once the hardware is stopped."
Suggested fix: move the free inside the last-port branch, and only free after a successful close:
```c
if (repr_id == xdev->num_repr_ports - 1) {
ret = xdev->dev_ops->dev_close(xdev);
if (ret == 0) {
rte_free(xdev->jumbo_buffer_pa);
xdev->jumbo_buffer_pa = NULL;
}
}
```
Review-Result: ERROR
More information about the test-report
mailing list