Skip to contentSkip to conversation

CVE-2022-49388: ubi: ubi_create_volume: Fix use-after-free when volume creation failed

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Feb 26, 2025

lore
Share & tools
lore
#0 lore raw

Description
===========

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

ubi: ubi_create_volume: Fix use-after-free when volume creation failed

There is an use-after-free problem for 'eba_tbl' in ubi_create_volume()'s error handling path:

ubi_eba_replace_table(vol, eba_tbl)

    vol->eba_tbl = tbl

out_mapping:
ubi_eba_destroy_table(eba_tbl) // Free 'eba_tbl'
out_unlock:
put_device(&vol->dev)

    vol_release
      kfree(tbl->entries)	  // UAF

Fix it by removing redundant 'eba_tbl' releasing.
Fetch a reproducer in [Link].

The Linux kernel CVE team has assigned CVE-2022-49388 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 4.12 with commit 493cfaeaa0c9bc0c79ce5751193d49fdac9aaaec and fixed in 4.14.283 with commit 25ff1e3a1351c0d936dd1ac2f9e58231ea1510c9
	Issue introduced in 4.12 with commit 493cfaeaa0c9bc0c79ce5751193d49fdac9aaaec and fixed in 4.19.247 with commit abb67043060f2bf4c03d7c3debb9ae980e2b6db3
	Issue introduced in 4.12 with commit 493cfaeaa0c9bc0c79ce5751193d49fdac9aaaec and fixed in 5.4.198 with commit 8302620aeb940f386817321d272b12411ae7d39f
	Issue introduced in 4.12 with commit 493cfaeaa0c9bc0c79ce5751193d49fdac9aaaec and fixed in 5.10.122 with commit 6d8d3f68cbecfd31925796f0fb668eb21ab06734
	Issue introduced in 4.12 with commit 493cfaeaa0c9bc0c79ce5751193d49fdac9aaaec and fixed in 5.15.47 with commit 5ff2514e4fb55dcf3d88294686040ca73ea0c1a2
	Issue introduced in 4.12 with commit 493cfaeaa0c9bc0c79ce5751193d49fdac9aaaec and fixed in 5.17.15 with commit e27ecf325e51abd06aaefba57a6322a46fa4178b
	Issue introduced in 4.12 with commit 493cfaeaa0c9bc0c79ce5751193d49fdac9aaaec and fixed in 5.18.4 with commit 1174ab8ba36a48025b68b5ff1085000b1e510217
	Issue introduced in 4.12 with commit 493cfaeaa0c9bc0c79ce5751193d49fdac9aaaec and fixed in 5.19 with commit 8c03a1c21d72210f81cb369cc528e3fde4b45411

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2022-49388

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
drivers/mtd/ubi/vmt.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/25ff1e3a1351c0d936dd1ac2f9e58231ea1510c9
	https://git.kernel.org/stable/c/abb67043060f2bf4c03d7c3debb9ae980e2b6db3
	https://git.kernel.org/stable/c/8302620aeb940f386817321d272b12411ae7d39f
	https://git.kernel.org/stable/c/6d8d3f68cbecfd31925796f0fb668eb21ab06734
	https://git.kernel.org/stable/c/5ff2514e4fb55dcf3d88294686040ca73ea0c1a2
	https://git.kernel.org/stable/c/e27ecf325e51abd06aaefba57a6322a46fa4178b
	https://git.kernel.org/stable/c/1174ab8ba36a48025b68b5ff1085000b1e510217
	https://git.kernel.org/stable/c/8c03a1c21d72210f81cb369cc528e3fde4b45411