netfilter: nf_tables: unconditionally bump set->nelems before insertion
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 35d0ac9070ef619e3bf44324375878a1c540387b · < 6826131c7674329335ca25df2550163eb8a1fd0c| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
netfilter: nf_tables: unconditionally bump set->nelems before insertion
In case that the set is full, a new element gets published then removed without waiting for the RCU grace period, while RCU reader can be walking over it already.
To address this issue, add the element transaction even if set is full, but toggle the set_full flag to report -ENFILE so the abort path safely unwinds the set to its previous state.
As for element updates, decrement set->nelems to restore it.
A simpler fix is to call synchronize_rcu() in the error path. However, with a large batch adding elements to already maxed-out set, this could cause noticeable slowdown of such batches.
From the CVE record · Linux
The Linux kernel's nf_tables can remove a newly published element from a full set without waiting for RCU readers. A reader already walking that element could encounter a use-after-free. The input does not specify whether exploitation requires network access, authentication, or user interaction.
Engineers running Linux kernels with netfilter nf_tables should check their versions; affected versions are not specified.