CVE-2021-47638
Severity CVSS v4.0:
Pending analysis
Type:
CWE-415
Double Free
Publication date:
26/02/2025
Last modified:
01/10/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
ubifs: rename_whiteout: Fix double free for whiteout_ui->data<br />
<br />
&#39;whiteout_ui->data&#39; will be freed twice if space budget fail for<br />
rename whiteout operation as following process:<br />
<br />
rename_whiteout<br />
dev = kmalloc<br />
whiteout_ui->data = dev<br />
kfree(whiteout_ui->data) // Free first time<br />
iput(whiteout)<br />
ubifs_free_inode<br />
kfree(ui->data) // Double free!<br />
<br />
KASAN reports:<br />
==================================================================<br />
BUG: KASAN: double-free or invalid-free in ubifs_free_inode+0x4f/0x70<br />
Call Trace:<br />
kfree+0x117/0x490<br />
ubifs_free_inode+0x4f/0x70 [ubifs]<br />
i_callback+0x30/0x60<br />
rcu_do_batch+0x366/0xac0<br />
__do_softirq+0x133/0x57f<br />
<br />
Allocated by task 1506:<br />
kmem_cache_alloc_trace+0x3c2/0x7a0<br />
do_rename+0x9b7/0x1150 [ubifs]<br />
ubifs_rename+0x106/0x1f0 [ubifs]<br />
do_syscall_64+0x35/0x80<br />
<br />
Freed by task 1506:<br />
kfree+0x117/0x490<br />
do_rename.cold+0x53/0x8a [ubifs]<br />
ubifs_rename+0x106/0x1f0 [ubifs]<br />
do_syscall_64+0x35/0x80<br />
<br />
The buggy address belongs to the object at ffff88810238bed8 which<br />
belongs to the cache kmalloc-8 of size 8<br />
==================================================================<br />
<br />
Let ubifs_free_inode() free &#39;whiteout_ui->data&#39;. BTW, delete unused<br />
assignment &#39;whiteout_ui->data_len = 0&#39;, process &#39;ubifs_evict_inode()<br />
-> ubifs_jnl_delete_inode() -> ubifs_jnl_write_inode()&#39; doesn&#39;t need it<br />
(because &#39;inc_nlink(whiteout)&#39; won&#39;t be excuted by &#39;goto out_release&#39;,<br />
and the nlink of whiteout inode is 0).
Impact
Base Score 3.x
5.50
Severity 3.x
MEDIUM
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.9 (including) | 4.14.276 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.15 (including) | 4.19.238 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.20 (including) | 5.4.189 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.5 (including) | 5.10.110 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.11 (including) | 5.15.33 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.16 (including) | 5.16.19 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.17 (including) | 5.17.2 (excluding) |
To consult the complete list of CPE names with products and versions, see this page
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/14276d38c89a170363e90b6ac0a53c3cf61b87fc
- https://git.kernel.org/stable/c/2ad07009c459e56ebdcc089d850d664660fdb742
- https://git.kernel.org/stable/c/2b3236ecf96db7af5836e1366ce39ace8ce832fa
- https://git.kernel.org/stable/c/40a8f0d5e7b3999f096570edab71c345da812e3e
- https://git.kernel.org/stable/c/6d7a158a7363c1f6604aa47ae1a280a5c65123dd
- https://git.kernel.org/stable/c/8b3c7be16f3f4dfd6e15ac651484e59d3fa36274
- https://git.kernel.org/stable/c/a90e2dbe66d2647ff95a0442ad2e86482d977fd8
- https://git.kernel.org/stable/c/b9a937f096e608b3368c1abc920d4d640ba2c94f



