mm/damon/sysfs-schemes: put stats for scheme_add_dirs() internal error
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
mm/damon/sysfs-schemes: put stats for scheme_add_dirs() internal error
damon_sysfs_scheme_add_dirs() setup the tried_regions directory after the stats directory setup is completed. When the tried_regions directory setup is failed, the setup function ensures the reference for the tried regions directory is released. Hence the error path should put references on setup succeeded directory objects, starting from the stats directory. However, the error path is putting the tried_regions directory instead of the stats directory.
As a direct result, the stats directory object is leaked. Worse yet, if the tried_regions directory setup failed from the initial allocation, the scheme->tried_regions field remains uninitialized. The following kobject_put(&scheme->tried_regions->kobj) call in the error path will dereference the uninitialized memory. The setup failures should not be common. But once it happens, the consequence is quite bad.
Fix this issue by correctly putting the stats directory instead of the tried_regions directory.
The issue was discovered [1] by Sashiko.
From the CVE record · Linux
The Linux kernel's DAMON sysfs scheme setup has an incorrect error path when creation of the tried_regions directory fails. It can leak a stats directory object or dereference uninitialized memory. The input does not establish an attacker action, access requirements, or user interaction needed to trigger the failure.
Engineers running Linux kernels with DAMON sysfs schemes should check whether their kernel is affected; affected versions are not specified.