[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230729203733.38949-2-sj@kernel.org>
Date: Sat, 29 Jul 2023 20:37:32 +0000
From: SeongJae Park <sj@...nel.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: SeongJae Park <sj@...nel.org>, damon@...ts.linux.dev,
linux-mm@...ck.org, stable@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 1/2] mm/damon/core: initialize damo_filter->list from damos_new_filter()
damos_new_filter() is not initializing the list field of newly allocated
filter object. However, DAMON sysfs interface and DAMON_RECLAIM are not
initializing it after calling damos_new_filter(). As a result,
accessing uninitialized memory is possible. Actually, adding multiple
DAMOS filters via DAMON sysfs interface caused NULL pointer
dereferencing. Initialize the field just after the allocation from
damos_new_filter().
Fixes: 98def236f63c ("mm/damon/core: implement damos filter")
Cc: stable@...r.kernel.org # 6.3.x-
Signed-off-by: SeongJae Park <sj@...nel.org>
---
mm/damon/core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/mm/damon/core.c b/mm/damon/core.c
index 91cff7f2997e..eb9580942a5c 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -273,6 +273,7 @@ struct damos_filter *damos_new_filter(enum damos_filter_type type,
return NULL;
filter->type = type;
filter->matching = matching;
+ INIT_LIST_HEAD(&filter->list);
return filter;
}
--
2.25.1
Powered by blists - more mailing lists