CVE-2026-31474
Received Received - Intake
Use-After-Free in Linux Kernel CAN ISOTP Transmit Buffer

Publication date: 2026-04-22

Last updated on: 2026-04-27

Assigner: kernel.org

Description
In the Linux kernel, the following vulnerability has been resolved: can: isotp: fix tx.buf use-after-free in isotp_sendmsg() isotp_sendmsg() uses only cmpxchg() on so->tx.state to serialize access to so->tx.buf. isotp_release() waits for ISOTP_IDLE via wait_event_interruptible() and then calls kfree(so->tx.buf). If a signal interrupts the wait_event_interruptible() inside close() while tx.state is ISOTP_SENDING, the loop exits early and release proceeds to force ISOTP_SHUTDOWN and continues to kfree(so->tx.buf) while sendmsg may still be reading so->tx.buf for the final CAN frame in isotp_fill_dataframe(). The so->tx.buf can be allocated once when the standard tx.buf length needs to be extended. Move the kfree() of this potentially extended tx.buf to sk_destruct time when either isotp_sendmsg() and isotp_release() are done.
CVSS Scores
EPSS Scores
Probability:
Percentile:
Meta Information
Published
2026-04-22
Last Modified
2026-04-27
Generated
2026-05-07
AI Q&A
2026-04-22
EPSS Evaluated
2026-05-05
NVD
EUVD
Affected Vendors & Products
Showing 12 associated CPEs
Vendor Product Version / Range
linux linux_kernel 6.4
linux linux_kernel 7.0
linux linux_kernel 7.0
linux linux_kernel 7.0
linux linux_kernel 7.0
linux linux_kernel 7.0
linux linux_kernel 7.0
linux linux_kernel 7.0
linux linux_kernel From 6.13 (inc) to 6.18.21 (exc)
linux linux_kernel From 6.19 (inc) to 6.19.11 (exc)
linux linux_kernel From 6.7 (inc) to 6.12.80 (exc)
linux linux_kernel From 6.4.1 (inc) to 6.6.131 (exc)
Helpful Resources
Exploitability
CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-416 The product reuses or references memory after it has been freed. At some point afterward, the memory may be allocated again and saved in another pointer, while the original pointer references a location somewhere within the new allocation. Any operations using the original pointer are no longer valid because the memory "belongs" to the code that operates on the new pointer.
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?

This vulnerability exists in the Linux kernel's CAN protocol implementation, specifically in the isotp_sendmsg() function. The issue is a use-after-free bug involving the tx.buf buffer. When a signal interrupts a wait inside the close() function while a transmission is still in progress, the release function prematurely frees the tx.buf memory. However, the sendmsg function may still be accessing this buffer to send the final CAN frame, leading to a use-after-free condition.

The fix involves deferring the freeing of the tx.buf buffer until the socket destruction phase (sk_destruct time), ensuring that both sending and releasing operations are fully completed before the memory is freed.


How can this vulnerability impact me? :

This use-after-free vulnerability can lead to undefined behavior such as memory corruption, crashes, or potential execution of arbitrary code within the kernel. Such impacts can compromise system stability and security, potentially allowing attackers to cause denial of service or escalate privileges.


What immediate steps should I take to mitigate this vulnerability?

The vulnerability is fixed by modifying the Linux kernel's isotp_sendmsg() and isotp_release() functions to properly manage the lifecycle of the tx.buf buffer, moving its deallocation to sk_destruct time. To mitigate this vulnerability immediately, you should update your Linux kernel to a version that includes this fix.


Ask Our AI Assistant
Need more information? Ask your question to get an AI reply (Powered by our expertise)
0/70
EPSS Chart