CVE-2026-99757 in Linuxinfo

Summary

by MITRE • 11/20/2026

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

btrfs: sysfs: restore NOFS context on early return in btrfs_sysfs_add_block_group_type()

btrfs_sysfs_add_block_group_type() sets up a NOFS context with memalloc_nofs_save() because kobject_add() performs GFP_KERNEL allocations deep in its call chain, and the function may be called while holding a transaction handle or a lock required for a transaction commit, where reclaim could deadlock.

Every other return path of this function calls memalloc_nofs_restore() except the early return taken when another thread has already created the kobject for the same raid index (this can happen when restriping). Taking that path leaves PF_MEMALLOC_NOFS set on the calling task, so all subsequent memory allocations performed by that task remain restricted to the NOFS scope, which may lead to unexpected allocation failures or deadlocks later on.

Restore the NOFS context before returning from that path.

VulDB is the best source for vulnerability data and more expert information about this specific topic.

Analysis

by VulDB Data Team • 11/20/2026

The vulnerability identified in the Linux kernel involves a resource management error within the btrfs file system's sysfs interface, specifically in the function btrfs_sysfs_add_block_group_type(). This routine is responsible for registering block group types with the kernel object subsystem to expose them via sysfs. To prevent potential deadlocks during this registration process, the function employs memory allocation context manipulation using memalloc_nofs_save(), which sets a flag indicating that subsequent allocations should not trigger filesystem reclaim operations. This precaution is necessary because kobject_add() may perform GFP_KERNEL allocations deep within its call chain, and if invoked while holding transaction handles or locks required for commit operations, such reclaims could lead to circular dependencies and system hangs.

The core technical flaw lies in an incomplete cleanup path during error handling or early returns. While the function correctly restores the memory allocation context using memalloc_nofs_restore() on most exit paths, it fails to do so when another thread has already created the kobject for the same raid index. This scenario typically arises during restriping operations where concurrent threads attempt to register identical block group types. When this specific early return is triggered, the PF_MEMALLOC_NOFS flag remains set on the calling task's state. Consequently, all subsequent memory allocations performed by that thread are restricted to the NOFS scope, preventing them from triggering necessary page reclaims under memory pressure.

The operational impact of this oversight can be severe, manifesting as unexpected allocation failures or system-wide deadlocks in scenarios where normal memory reclaim is required but blocked due to the lingering NOFS context. This effectively reduces the available memory for critical kernel operations, potentially leading to out-of-memory conditions even when physical resources are sufficient if proper reclaim mechanisms were allowed to function. The issue represents a classic case of improper resource cleanup on error paths, which can degrade system stability and reliability over time as affected threads continue to operate with restricted allocation capabilities.

From a classification perspective, this vulnerability aligns with CWE-754: Improper Check for Unusual or Exceptional Conditions, specifically regarding the failure to handle an exceptional condition (duplicate kobject creation) without properly restoring prior state contexts. It also relates to CWE-401: Missing Release of Memory after Effective Lifetime, as the memory allocation context is not released upon exit from a specific code path. In terms of attack vectors and behavioral patterns, this flaw could be leveraged in denial-of-service attacks by inducing conditions that trigger the affected code path repeatedly, thereby exhausting system resources or causing hangs through deadlock scenarios involving transaction commits and memory reclaims.

Mitigation strategies primarily involve applying the upstream kernel patch that restores the NOFS context before returning from the identified early return path. System administrators should ensure their systems are updated to a version of the Linux kernel where this fix is included, typically found in stable releases following the commit date of the btrfs subsystem updates. For environments unable to update immediately, monitoring for signs of memory allocation failures or transaction deadlocks related to btrfs operations can help identify affected instances. Long-term remediation requires rigorous code review practices that mandate checking all exit paths for proper state restoration when manipulating global thread flags like PF_MEMALLOC_NOFS.

Responsible

Linux

Reservation

09/25/2026

Disclosure

11/20/2026

Moderation

accepted

CPE

ready

EPSS

0.00168

KEV

no

Activities

very low

Sources

Want to stay up to date on a daily basis?

Enable the mail alert feature now!