Linux · Linux Kernel · CVE-2022-48733
**Name of the Vulnerable Software and Affected Versions**
Linux kernel (affected versions not specified)
**Description**
The issue is related to a use-after-free vulnerability in the Linux kernel's btrfs file system. Specifically, it occurs when creating a snapshot and the `btrfs commit transaction()` function fails, leading to a situation where a pending snapshot structure is freed but still accessible, resulting in a user-after-free scenario. This can happen in the following sequence:
1. A pending snapshot is allocated and added to the transaction's list of pending snapshots.
2. `btrfs commit transaction()` is called, and if it fails, the pending snapshot structure is freed.
3. Another task commits the transaction without errors, accessing the already freed pending snapshot structure, thus causing a user-after-free.
The vulnerability could be detected by smatch, which produced a warning about the pending snapshot not being removed from the list. To fix this, the snapshot creation ioctl should not directly add the pending snapshot to the transaction's list. Instead, it should add the pending snapshot to the transaction handle, and then at `btrfs commit transaction()`, add the snapshot to the list only when it can be guaranteed that any error returned after that point will result in a transaction abort.
**Recommendations**
At the moment, there is no information about a newer version that contains a fix for this vulnerability.