CVE-2026-45887: af_unix: Fix memleak of newsk in unix_stream_connect().
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
af_unix: Fix memleak of newsk in unix_stream_connect().
When prepare_peercred() fails in unix_stream_connect(), unix_release_sock() is not called for newsk, and the memory is leaked.
Let's move prepare_peercred() before unix_create1().
The Linux kernel CVE team has assigned CVE-2026-45887 to this issue.
Affected and fixed versions
===========================
Issue introduced in 6.16 with commit fd0a109a0f6b7524543d17520da92a44a9f5343c and fixed in 6.18.14 with commit 365996a2b14d07caa9e33d367b67ea26c09d89b4 Issue introduced in 6.16 with commit fd0a109a0f6b7524543d17520da92a44a9f5343c and fixed in 6.19.4 with commit a5d95d7caba0160fb7b2b8d2bd96d5a1be861d9f Issue introduced in 6.16 with commit fd0a109a0f6b7524543d17520da92a44a9f5343c and fixed in 7.0 with commit 6884028cd7f275f8bcb854a347265cb1fb0e4bea
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-45887
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/unix/af_unix.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/365996a2b14d07caa9e33d367b67ea26c09d89b4 https://git.kernel.org/stable/c/a5d95d7caba0160fb7b2b8d2bd96d5a1be861d9f https://git.kernel.org/stable/c/6884028cd7f275f8bcb854a347265cb1fb0e4bea