The patch titled Subject: mm/damon/sysfs-schemes: handle tried regions sysfs directory allocation failure has been added to the -mm mm-hotfixes-unstable branch. Its filename is mm-damon-sysfs-schemes-handle-tried-regions-sysfs-directory-allocation-failure.patch
This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches...
This patch will later appear in the mm-hotfixes-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days
------------------------------------------------------ From: SeongJae Park sj@kernel.org Subject: mm/damon/sysfs-schemes: handle tried regions sysfs directory allocation failure Date: Mon, 6 Nov 2023 23:34:07 +0000
DAMOS tried regions sysfs directory allocation function (damon_sysfs_scheme_regions_alloc()) is not handling the memory allocation failure. In the case, the code will dereference NULL pointer. Handle the failure to avoid such invalid access.
Link: https://lkml.kernel.org/r/20231106233408.51159-3-sj@kernel.org Fixes: 9277d0367ba1 ("mm/damon/sysfs-schemes: implement scheme region directory") Signed-off-by: SeongJae Park sj@kernel.org Cc: stable@vger.kernel.org [6.2+] Signed-off-by: Andrew Morton akpm@linux-foundation.org ---
mm/damon/sysfs-schemes.c | 3 +++ 1 file changed, 3 insertions(+)
--- a/mm/damon/sysfs-schemes.c~mm-damon-sysfs-schemes-handle-tried-regions-sysfs-directory-allocation-failure +++ a/mm/damon/sysfs-schemes.c @@ -162,6 +162,9 @@ damon_sysfs_scheme_regions_alloc(void) struct damon_sysfs_scheme_regions *regions = kmalloc(sizeof(*regions), GFP_KERNEL);
+ if (!regions) + return NULL; + regions->kobj = (struct kobject){}; INIT_LIST_HEAD(®ions->regions_list); regions->nr_regions = 0; _
Patches currently in -mm which might be from sj@kernel.org are
mm-damon-sysfs-check-error-from-damon_sysfs_update_target.patch mm-damon-sysfs-schemes-handle-tried-regions-sysfs-directory-allocation-failure.patch mm-damon-sysfs-schemes-handle-tried-region-directory-allocation-failure.patch
linux-stable-mirror@lists.linaro.org