ubifs: Fix memleak when insert_old_idx() failed
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 1e51764a3c2ac05a23a22b2a95ddee4d9bffb16d · < 79079cebbeed624b9d01cfcf1e3254ae1a1f6e14| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
ubifs: Fix memleak when insert_old_idx() failed
Following process will cause a memleak for copied up znode:
dirty_cow_znode zn = copy_znode(c, znode); err = insert_old_idx(c, zbr->lnum, zbr->offs); if (unlikely(err)) return ERR_PTR(err); // No one refers to zn.
Fetch a reproducer in [Link].
Function copy_znode() is split into 2 parts: resource allocation and znode replacement, insert_old_idx() is split in similar way, so resource cleanup could be done in error handling path without corrupting metadata(mem & disk). It's okay that old index inserting is put behind of add_idx_dirt(), old index is used in layout_leb_in_gaps(), so the two processes do not depend on each other.
From the CVE record · Linux
The Linux kernel's UBIFS code can leak memory allocated for a copied znode if insert_old_idx() fails. The input does not establish whether an attacker can trigger this failure or specify any access or user-interaction requirements.
Engineers running Linux kernels with UBIFS should check their deployments; affected versions are not specified.