In the Linux kernel, the following vulnerability has been resolved:
mm/damon/core: fix new damontarget objects leaks on damoncommit_targets()
Patch series "mm/damon/core: fix memory leaks and ignored inputs from damoncommitctx()".
Due to two bugs in damoncommittargets() and damoncommitschemes(), which are called from damoncommitctx(), some user inputs can be ignored, and some mmeory objects can be leaked. Fix those.
Note that only DAMON sysfs interface users are affected. Other DAMON core API user modules that more focused more on simple and dedicated production usages, including DAMONRECLAIM and DAMONLRU_SORT are not using the buggy function in the way, so not affected.
This patch (of 2):
When new DAMON targets are added via damoncommittargets(), the newly created targets are not deallocated when updating the internal data (damoncommittarget()) is failed. Worse yet, even if the setup is successfully done, the new target is not linked to the context. Hence, the new targets are always leaked regardless of the internal data setup failure. Fix the leaks.