ipv4: route: Prevent rt_bind_exception() from rebinding stale fnhe
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 67d6d681e15b578c1725bad8ad079e05d1c48a8e · < b84f083f50ecc736a95091691339a1b363962f0e| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
ipv4: route: Prevent rt_bind_exception() from rebinding stale fnhe
The sit driver's packet transmission path calls: sit_tunnel_xmit() -> update_or_create_fnhe(), which lead to fnhe_remove_oldest() being called to delete entries exceeding FNHE_RECLAIM_DEPTH+random.
The race window is between fnhe_remove_oldest() selecting fnheX for deletion and the subsequent kfree_rcu(). During this time, the concurrent path's __mkroute_output() -> find_exception() can fetch the soon-to-be-deleted fnheX, and rt_bind_exception() then binds it with a new dst using a dst_hold(). When the original fnheX is freed via RCU, the dst reference remains permanently leaked.
CPU 0 CPU 1 __mkroute_output() find_exception() [fnheX] update_or_create_fnhe() fnhe_remove_oldest() [fnheX] rt_bind_exception() [bind dst] RCU callback [fnheX freed, dst leak]
This issue manifests as a device reference count leak and a warning in dmesg when unregistering the net device:
unregister_netdevice: waiting for sitX to become free. Usage count = N
Ido Schimmel provided the simple test validation method [1].
From the CVE record · Linux
A race in the Linux kernel’s IPv4 routing code can bind a route to an exception entry that is about to be freed. When exception removal and route binding happen concurrently, this leaks a device reference and can leave a network device unable to unregister. The input does not specify whether an attacker can trigger the race remotely, whether authentication is needed, or whether user interaction is required.
Engineers running Linux kernels should check their versions against the vendor advisory; affected versions are not specified in the input.