CVE-2024-56644

Source
https://cve.org/CVERecord?id=CVE-2024-56644
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2024-56644.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2024-56644
Downstream
Related
Published
2024-12-27T15:02:45.664Z
Modified
2026-03-11T07:44:12.984820345Z
Summary
net/ipv6: release expired exception dst cached in socket
Details

In the Linux kernel, the following vulnerability has been resolved:

net/ipv6: release expired exception dst cached in socket

Dst objects get leaked in ip6negativeadvice() when this function is executed for an expired IPv6 route located in the exception table. There are several conditions that must be fulfilled for the leak to occur: * an ICMPv6 packet indicating a change of the MTU for the path is received, resulting in an exception dst being created * a TCP connection that uses the exception dst for routing packets must start timing out so that TCP begins retransmissions * after the exception dst expires, the FIB6 garbage collector must not run before TCP executes ip6negativeadvice() for the expired exception dst

When TCP executes ip6negativeadvice() for an exception dst that has expired and if no other socket holds a reference to the exception dst, the refcount of the exception dst is 2, which corresponds to the increment made by dstinit() and the increment made by the TCP socket for which the connection is timing out. The refcount made by the socket is never released. The refcount of the dst is decremented in skdstreset() but that decrement is counteracted by a dsthold() intentionally placed just before the skdstreset() in ip6negativeadvice(). After ip6negativeadvice() has finished, there is no other object tied to the dst. The socket lost its reference stored in skdstcache and the dst is no longer in the exception table. The exception dst becomes a leaked object.

As a result of this dst leak, an unbalanced refcount is reported for the loopback device of a net namespace being destroyed under kernels that do not contain e5f80fcf869a ("ipv6: give an IPv6 dev to blackholenetdev"): unregisternetdevice: waiting for lo to become free. Usage count = 2

Fix the dst leak by removing the dsthold() in ip6negativeadvice(). The patch that introduced the dsthold() in ip6negativeadvice() was 92f1655aa2b22 ("net: fix __dstnegativeadvice() race"). But 92f1655aa2b22 merely refactored the code with regards to the dst refcount so the issue was present even before 92f1655aa2b22. The bug was introduced in 54c1a859efd9f ("ipv6: Don't drop cache route entry unless timer actually expired.") where the expired cached route is deleted and the skdstcache member of the socket is set to NULL by calling dstnegativeadvice() but the refcount belonging to the socket is left unbalanced.

The IPv4 version - ipv4negativeadvice() - is not affected by this bug. When the TCP connection times out ipv4negativeadvice() merely resets the skdstcache of the socket while decrementing the refcount of the exception dst.

Database specific
{
    "cna_assigner": "Linux",
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/56xxx/CVE-2024-56644.json"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
54c1a859efd9fd6cda05bc700315ba2519c14eba
Fixed
a95808252e8acc0123bacd2dff8b9af10bc145b7
Fixed
b90d061345bb8cd51fece561a800bae1c95448a6
Fixed
0b8903e6c881f72c6849d4952de742c656eb5ab9
Fixed
535add1e9f274502209cb997801208bbe1ae6c6f
Fixed
f43d12fd0fa8ee5b9caf8a3927e10d06431764d2
Fixed
8b591bd522b71c42a82898290e35d32b482047e4
Fixed
3301ab7d5aeb0fe270f73a3d4810c9d1b6a9f045
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
0 Unknown introduced commit / All previous commits are affected
Last affected
9c93e9c757c7d3d96027a06b9b4c4e37ca87ded7

Database specific

source
"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2024-56644.json"