veth: fix NAPI leak in XDP enable error path
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ b02e5a0ebb172c8276cea3151942aac681f7a4a6 · < 4bd2e5dbe62334aae1182d0f0d260f334a49d739| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
veth: fix NAPI leak in XDP enable error path
During XDP enablement in veth, if xdp_rxq_info_reg() or xdp_rxq_info_reg_mem_model() fails, the driver rolls back the changes.
However, the rollback loop: for (i--; i >= start; i--) {
decrements the loop index 'i' before the first iteration. This correctly skips unregistering the rxq for the failed index 'i' (as registration failed or was already cleaned up), but it also erroneously skips calling netif_napi_deli() for rq[i].xdp_napi.
Since netif_napi_add() was already called for index 'i', this leaves a dangling napi_struct in the device's napi_list. When the veth device is later destroyed, the freed queue memory (which contains the leaked NAPI structure) can be reused.
The subsequent device teardown iterates the NAPI list and corrupts the reallocated memory, leading to UAF.
Fix this by explicitly deleting the NAPI association for the failed index 'i' before rolling back the successfully configured queues.
From the CVE record · Linux
The veth driver can leave a NAPI structure dangling if queue registration fails during XDP enablement. Later device teardown can corrupt reused memory, leading to a use-after-free; the input does not specify how an attacker could trigger this condition or whether authentication or user interaction is required.
Engineers running Linux kernels with the veth driver should check their kernel versions; affected versions are not specified.