linux-stable/mm/damon
Jianglei Nie 9d3e9e1e08 mm/damon/reclaim: fix potential memory leak in damon_reclaim_init()
[ Upstream commit 188043c7f4 ]

damon_reclaim_init() allocates a memory chunk for ctx with
damon_new_ctx().  When damon_select_ops() fails, ctx is not released,
which will lead to a memory leak.

We should release the ctx with damon_destroy_ctx() when damon_select_ops()
fails to fix the memory leak.

Link: https://lkml.kernel.org/r/20220714063746.2343549-1-niejianglei2021@163.com
Fixes: 4d69c34578 ("mm/damon/reclaim: use damon_select_ops() instead of damon_{v,p}a_set_operations()")
Signed-off-by: Jianglei Nie <niejianglei2021@163.com>
Reviewed-by: SeongJae Park <sj@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-08-17 14:42:29 +02:00
..
Kconfig mm/damon: implement a minimal stub for sysfs-based DAMON interface 2022-03-22 15:57:13 -07:00
Makefile mm/damon: implement a minimal stub for sysfs-based DAMON interface 2022-03-22 15:57:13 -07:00
core-test.h mm/damon: remove the target id concept 2022-03-22 15:57:12 -07:00
core.c mm/damon: prevent activated scheme from sleeping by deactivated schemes 2022-04-01 11:46:09 -07:00
dbgfs-test.h mm/damon/dbgfs-test: fix is_target_id() change 2022-03-22 15:57:12 -07:00
dbgfs.c mm/damon/core: allow non-exclusive DAMON start/stop 2022-03-22 15:57:13 -07:00
ops-common.c mm/damon: rename damon_primitives to damon_operations 2022-03-22 15:57:12 -07:00
ops-common.h mm/damon: rename damon_primitives to damon_operations 2022-03-22 15:57:12 -07:00
paddr.c Folio changes for 5.18 2022-03-22 17:03:12 -07:00
reclaim.c mm/damon/reclaim: fix potential memory leak in damon_reclaim_init() 2022-08-17 14:42:29 +02:00
sysfs.c mm/damon/sysfs: remove repeat container_of() in damon_sysfs_kdamond_release() 2022-03-22 15:57:13 -07:00
vaddr-test.h mm/damon: rename damon_primitives to damon_operations 2022-03-22 15:57:12 -07:00
vaddr.c mm/damon: use set_huge_pte_at() to make huge pte old 2022-07-22 10:21:19 +02:00