Skip to contentSkip to conversation

CVE-2026-31532: can: raw: fix ro->uniq use-after-free in raw_rcv()

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Apr 23

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

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

can: raw: fix ro->uniq use-after-free in raw_rcv()

raw_release() unregisters raw CAN receive filters via can_rx_unregister(), but receiver deletion is deferred with call_rcu(). This leaves a window where raw_rcv() may still be running in an RCU read-side critical section after raw_release() frees ro->uniq, leading to a use-after-free of the percpu uniq storage.

Move free_percpu(ro->uniq) out of raw_release() and into a raw-specific socket destructor. can_rx_unregister() takes an extra reference to the socket and only drops it from the RCU callback, so freeing uniq from sk_destruct ensures the percpu area is not released until the relevant callbacks have drained.

[mkl: applied manually]

The Linux kernel CVE team has assigned CVE-2026-31532 to this issue.

Affected and fixed versions
===========================

	Fixed in 6.12.83 with commit 572f0bf536ebc14f6e7da3d21a85cf076de8358e
	Fixed in 6.18.24 with commit 1a0f2de81f7fbdc538fc72d7d74609b79bc83cc0
	Fixed in 6.19.14 with commit 7201a531b9a5ed892bfda5ded9194ef622de8ffa
	Fixed in 7.0.1 with commit 34c1741254ff972e8375faf176678a248826fe3a

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2026-31532

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
net/can/raw.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/572f0bf536ebc14f6e7da3d21a85cf076de8358e
	https://git.kernel.org/stable/c/1a0f2de81f7fbdc538fc72d7d74609b79bc83cc0
	https://git.kernel.org/stable/c/7201a531b9a5ed892bfda5ded9194ef622de8ffa
	https://git.kernel.org/stable/c/34c1741254ff972e8375faf176678a248826fe3a
	https://git.kernel.org/stable/c/a535a9217ca3f2fccedaafb2fddb4c48f27d36dc