CVE-2023-53825
Description
In the Linux kernel, the following vulnerability has been resolved:
kcm: Fix error handling for SOCK_DGRAM in kcm_sendmsg().
syzkaller found a memory leak in kcm_sendmsg(), and commit c821a88bd720 ("kcm: Fix memory leak in error path of kcm_sendmsg()") suppressed it by updating kcm_tx_msg(head)->last_skb if partial data is copied so that the following sendmsg() will resume from the skb.
However, we cannot know how many bytes were copied when we get the error. Thus, we could mess up the MSG_MORE queue.
When kcm_sendmsg() fails for SOCK_DGRAM, we should purge the queue as we do so for UDP by udp_flush_pending_frames().
Even without this change, when the error occurred, the following sendmsg() resumed from a wrong skb and the queue was messed up. However, we have yet to get such a report, and only syzkaller stumbled on it. So, this can be changed safely.
Note this does not change SOCK_SEQPACKET behaviour.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
In the Linux kernel, KCM's kcm_sendmsg() for SOCK_DGRAM leaks memory and can corrupt the MSG_MORE queue on error, requiring a purge.
Vulnerability
In the Linux kernel's Kernel Connection Multiplexor (KCM) subsystem, the kcm_sendmsg() function's error handling for SOCK_DGRAM sockets is flawed. When an error occurs during message transmission after partial data has been copied into an skb, there is a memory leak because the partially-constructed skb is not properly freed. A prior fix (commit c821a88bd720) attempted to address the leak by updating kcm_tx_msg(head)->last_skb so that a subsequent sendmsg() call could resume from the last partially-copied skb. However, the kernel's description notes that it is impossible to know how many bytes were already copied when the error occurred, so resuming from that skb can corrupt the MSG_MORE queue, leading to data corruption or kernel state instability [1].
Exploitation
An attacker would need the ability to invoke the sendmsg() system call on a KCM socket of type SOCK_DGRAM and cause an error during the message copy phase. This can be achieved by sending a message on such a socket. A local user or a process with access to such a socket can exploit this condition. The attack surface is limited to users with the capability to create and use KCM sockets, but no special privileges beyond the ability to call sendmsg() are required. Syzkaller, a kernel fuzzer, discovered this issue, indicating it can be triggered by crafted input [2].
Impact
An attacker who successfully triggers this vulnerability can cause a memory leak, depleting kernel memory over time, and also corrupt the MSG_MORE queue's internal state. This could result in data corruption for subsequent messages or a denial-of-service condition because the following sendmsg() call may use a wrong skb, leading to unpredictable kernel behavior. The impact is primarily availability and integrity of kernel socket operations, but it does not directly lead to privilege escalation [3].
Mitigation
The fix, included in Linux kernel stable updates, purges the pending queue in the error path for SOCK_DGRAM, mirroring how UDP handles similar failures with udp_flush_pending_frames(). Administrators should apply kernel updates that incorporate commit a22730b1b4bf or its backports (such as e5b28ce127a6 or 55d2e7c1ab8e). No workaround is available other than avoiding the use of KCM sockets or restricting access to them via security modules or containerization [1, 2, 3].
AI Insight generated on May 19, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected products
2Patches
821b467735b08d4b8f380b0a01ce8362b4ac62e18493c421455d2e7c1ab8ee5b28ce127a6992b2ac783aaa22730b1b4bfVulnerability mechanics
Generated on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
8- git.kernel.org/stable/c/1ce8362b4ac6b8e65fd04a22ea37ec776ee1ec5bnvd
- git.kernel.org/stable/c/21b467735b0888a8daa048f83d3b9b50fdab71cenvd
- git.kernel.org/stable/c/2e18493c421428a936946c452461b8e979088f17nvd
- git.kernel.org/stable/c/55d2e7c1ab8eaa7b62575b8a4194132795d1f9fcnvd
- git.kernel.org/stable/c/992b2ac783aad360b98ed9d4686e86176a20f6f1nvd
- git.kernel.org/stable/c/a22730b1b4bf437c6bbfdeff5feddf54be4aeadanvd
- git.kernel.org/stable/c/d4b8f380b0a041ee6a84fdac14127d8fe1dcad7bnvd
- git.kernel.org/stable/c/e5b28ce127a690f3acc49a6a342e6c9442c9edd6nvd
News mentions
0No linked articles in our index yet.