ext4: fix circular lock dependency in ext4_ext_migrate
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ cb85f4d23f794e24127f3e562cb3b54b0803f456 · < a897682793eba5de51ee6f3152760374afa629cf| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
ext4: fix circular lock dependency in ext4_ext_migrate
Move iput(tmp_inode) after ext4_writepages_up_write() to avoid a circular lock dependency between s_writepages_rwsem and sb_internal (freeze protection).
The deadlock scenario:
CPU0 (EXT4_IOC_MIGRATE) CPU1 (orphan cleanup during mount) ---- ---- ext4_ext_migrate() ext4_writepages_down_write() s_writepages_rwsem (write) ext4_evict_inode() sb_start_intwrite() [sb_internal] ... ext4_writepages() s_writepages_rwsem (read) [BLOCKED] iput(tmp_inode) ext4_evict_inode() sb_start_intwrite() [BLOCKED]
The tmp_inode is a temporary inode with nlink=0 created solely for building the extent tree. Its eviction does not require s_writepages_rwsem protection, so deferring iput() until after releasing the rwsem is safe.
From the CVE record · Linux
The Linux kernel's ext4 extent migration can deadlock because temporary inode eviction creates a circular lock dependency. The described scenario involves a local EXT4_IOC_MIGRATE operation running concurrently with orphan cleanup during mount; the input does not specify authentication requirements.
Engineers running Linux kernels with ext4 should check their deployments; affected versions are not specified.