hulk inclusion category: bugfix bugzilla: https://atomgit.com/openeuler/kernel/issues/9935 -------------------------------- In page_in_dynamic_pool(), the dpool refcount is incremented in dpool_get_from_page(). However, when dpagelist is enabled and the PFN does not belong to dpagelist, the function updates dpool to NULL without releasing the acquired refcount, leading to a refcount leak. Fix this by releasing the refcount before setting dpool to NULL. Fixes: 93b77bfae066 ("mm/dynamic_pool: compatible with HugeTLB dissolve") Signed-off-by: Wupeng Ma <mawupeng1@huawei.com> --- mm/dynamic_pool.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/dynamic_pool.c b/mm/dynamic_pool.c index 89ea36b17e479..b9249a1c5d20a 100644 --- a/mm/dynamic_pool.c +++ b/mm/dynamic_pool.c @@ -193,7 +193,8 @@ bool page_in_dynamic_pool(struct page *page) goto out; } - /* The pfn is not in the range, set dpool to NULL */ + /* The pfn is not in the range, release dpool & set dpool to NULL */ + dpool_put(dpool); dpool = NULL; } -- 2.43.0