CVE-2024-49881 ext4: update orig_path in ext4_find_extent()

Medium 5.5 Published Updated

A local attacker can trigger a NULL pointer dereference in the ext4 filesystem, causing a kernel crash and denial of service.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2024-49881?

CVE-2024-49881 is a medium-severity vulnerability in Linux kernel, published on 21 Oct 2024. It can only be exploited from the same machine or local network, with no action from the victim.

Official description

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

ext4: update orig_path in ext4_find_extent()

In ext4_find_extent(), if the path is not big enough, we free it and set *orig_path to NULL. But after reallocating and successfully initializing the path, we don't update *orig_path, in which case the caller gets a valid path but a NULL ppath, and this may cause a NULL pointer dereference or a path memory leak. For example:

ext4_split_extent path = *ppath = 2000 ext4_find_extent if (depth > path[0].p_maxdepth) kfree(path = 2000); *orig_path = path = NULL; path = kcalloc() = 3000 ext4_split_extent_at(*ppath = NULL) path = *ppath; ex = path[depth].p_ext; // NULL pointer dereference!

================================================================== BUG: kernel NULL pointer dereference, address: 0000000000000010 CPU: 6 UID: 0 PID: 576 Comm: fsstress Not tainted 6.11.0-rc2-dirty #847 RIP: 0010:ext4_split_extent_at+0x6d/0x560 Call Trace: <TASK> ext4_split_extent.isra.0+0xcb/0x1b0 ext4_ext_convert_to_initialized+0x168/0x6c0 ext4_ext_handle_unwritten_extents+0x325/0x4d0 ext4_ext_map_blocks+0x520/0xdb0 ext4_map_blocks+0x2b0/0x690 ext4_iomap_begin+0x20e/0x2c0 [...] ==================================================================

Therefore, *orig_path is updated when the extent lookup succeeds, so that the caller can safely use path or *ppath.

Weakness: CWE-476

Which versions are affected by CVE-2024-49881?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2024-49881?

Apply the vendor's patch.

Is CVE-2024-49881 being exploited?

There is no known exploitation of CVE-2024-49881 in the wild and no public exploit code.

All Linux kernel vulnerabilities

Sources

Also known as AZL-51544, BELL-CVE-2024-49881, DEBIAN-CVE-2024-49881, GHSA-pvgc-vpgw-88mq, UBUNTU-CVE-2024-49881.

Is CVE-2024-49881 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free