CVE-2026-139215

Not scored yetLast modified Nov 30, 2026

Description

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

nsproxy: Fix cred leak in the error path of prepare_nsset()

A task that calls setns() with CLONE_NEWUSER together with CLONE_NEWNS and at least one more namespace flag leaks a struct cred (and the user_namespace, ucounts and group_info references it holds) whenever the call fails at the fs_struct copy. On a kernel with CONFIG_USER_NS the leak is one cred per failed setns(); under memory pressure, or driven by a fault-injecting attacker, it accumulates and pins user namespaces that can then never be freed.

prepare_nsset() sets nsset->flags only on the success path:

if (flags & CLONE_NEWUSER) nsset->cred = prepare_creds(); ... } else if (flags & CLONE_NEWNS) { nsset->fs = copy_fs_struct(me->fs); if (!nsset->fs) goto out; /* flags still 0 here */ } nsset->flags = flags; return 0; out: put_nsset(nsset);

put_nsset() decides what to release from nsset->flags:

if (flags & CLONE_NEWUSER) put_cred(nsset_cred(nsset));

On the copy_fs_struct() failure arm prepare_creds() has already allocated the cred, but nsset->flags is still the zero from the caller's "struct nsset nsset = {}", so put_nsset() does not see CLONE_NEWUSER and never drops it. The caller (__do_sys_setns) returns the error without touching nsset, so the cred is lost.

Set nsset->flags at the start of prepare_nsset(), before anything can fail, so every error exit through put_nsset() releases what was taken. commit_nsset(), which clears nsset->cred on success, is unaffected.

Reproduced on x86_64 under QEMU with failslab aimed at the fs_struct cache and kmemleak enabled: 500 calls of setns(pidfd, CLONE_NEWUSER | CLONE_NEWNS | CLONE_NEWUTS) each fail with -ENOMEM and leave 851 unreferenced cred objects allocated from prepare_creds() via setns() before the fix, and none after (the program is in the notes below).

Found by formal verification of kernel/nsproxy.c.

Metrics

No CVSS score has been published yet.

Affected software

Source: the vendor's advisory (CNA). NVD analysis pending.

No affected versions have been published.

Timeline

Published
Nov 30, 2026
Last modified
Nov 30, 2026
NVD status
Received

Related CVEs from 2026

CVE-2026-139216In the Linux kernel, the following vulnerability has been resolved: ntfs: fix u16 truncation of the update sequence array count check ntfsCVE-2026-1392177.8In the Linux kernel, the following vulnerability has been resolved: ntfs: reject index blocks with a too small entries offset Index blocksCVE-2026-1392187.8In the Linux kernel, the following vulnerability has been resolved: tipc: fix use-after-free of broadcast reception link at node release WCVE-2026-1392197.8In the Linux kernel, the following vulnerability has been resolved: net: shrink the payload-only part of skb dataref to one bit skb_shinfoCVE-2026-139226.5Side-channel information leakage in Paint in Google Chrome prior to 150.0.7871.47 allowed a remote attacker to leak cross-origin data via a CVE-2026-139220In the Linux kernel, the following vulnerability has been resolved: net: hibmcge: set netdev_ops before hbg_init() to fix NULL pointer dereCVE-2026-139221In the Linux kernel, the following vulnerability has been resolved: ionic: free port_info when probe fails after the port is set up ionic_CVE-2026-1392227.0In the Linux kernel, the following vulnerability has been resolved: ionic: fix port_info use-after-free on firmware recovery ionic_port_inCVE-2026-139223In the Linux kernel, the following vulnerability has been resolved: nvme-fabrics: clear the poll map if no poll queues are mapped blk_mq_aCVE-2026-139224In the Linux kernel, the following vulnerability has been resolved: nvme-fabrics: reset io_queues before computing the queue mapping nvmf_CVE-2026-139225In the Linux kernel, the following vulnerability has been resolved: net/mlx5: HWS, fix modify header pool match for copy actions mlx5_fs_hCVE-2026-139226In the Linux kernel, the following vulnerability has been resolved: Drivers: hv: Run VMBus kexec cleanup from syscore shutdown ARM64 Hyper
CVE-2026-139215: Unscored | Vulnix