[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220503220531.45913-1-sj@kernel.org>
Date: Tue, 3 May 2022 22:05:31 +0000
From: SeongJae Park <sj@...nel.org>
To: akpm@...ux-foundation.org
Cc: damon@...ts.linux.dev, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, SeongJae Park <sj@...nel.org>
Subject: [PATCH] mm/damon/sysfs: fix pid leak under fvaddr ops use case
Commit c83136469313 ("mm/damon/sysfs: support fixed virtual address
ranges monitoring") in 'mm-unstable' does not put the monitoring target
pid when fvaddr ops is used. This commit fixes it to put pid properly.
Andrew, please merge this into the 'mm-unstable' commit
("mm/damon/sysfs: support fixed virtual address ranges monitoring").
Fixes: c83136469313 ("mm/damon/sysfs: support fixed virtual address ranges monitoring")
Signed-off-by: SeongJae Park <sj@...nel.org>
---
mm/damon/sysfs.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
index 767ab8c33e4d..f753bb405101 100644
--- a/mm/damon/sysfs.c
+++ b/mm/damon/sysfs.c
@@ -2086,7 +2086,8 @@ static void damon_sysfs_destroy_targets(struct damon_ctx *ctx)
struct damon_target *t, *next;
damon_for_each_target_safe(t, next, ctx) {
- if (ctx->ops.id == DAMON_OPS_VADDR)
+ if (ctx->ops.id == DAMON_OPS_VADDR ||
+ ctx->ops.id == DAMON_OPS_FVADDR)
put_pid(t->pid);
damon_destroy_target(t);
}
@@ -2204,7 +2205,7 @@ static void damon_sysfs_before_terminate(struct damon_ctx *ctx)
{
struct damon_target *t, *next;
- if (ctx->ops.id != DAMON_OPS_VADDR)
+ if (ctx->ops.id != DAMON_OPS_VADDR && ctx->ops.id != DAMON_OPS_FVADDR)
return;
mutex_lock(&ctx->kdamond_lock);
--
2.25.1
Powered by blists - more mailing lists