]> git.baikalelectronics.ru Git - kernel.git/commit
mm/damon/lru_sort: fix potential memory leak in damon_lru_sort_init()
authorSeongJae Park <sj@kernel.org>
Thu, 14 Jul 2022 17:04:58 +0000 (17:04 +0000)
committerakpm <akpm@linux-foundation.org>
Mon, 18 Jul 2022 00:14:27 +0000 (17:14 -0700)
commita3fe650b225a2d37de31656acb97748eb991d16e
treeeae277a5094c0109ef29fee18d7181f5b9626add
parent5abd75b8f881e3f337b36051a8a4e5ccd9d0d090
mm/damon/lru_sort: fix potential memory leak in damon_lru_sort_init()

damon_lru_sort_init() returns an error when damon_select_ops() fails
without freeing 'ctx' which allocated before.  This commit fixes the
potential memory leak by freeing 'ctx' under the situation.

Link: https://lkml.kernel.org/r/20220714170458.49727-1-sj@kernel.org
Fixes: 7a6c0f0f0184 ("mm/damon: introduce DAMON-based LRU-lists Sorting")
Signed-off-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/damon/lru_sort.c