diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2021-12-31 09:28:48 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2021-12-31 09:28:48 -0800 |
commit | f87bcc88f3028af584b0820bdf6e0e4cdc759d26 (patch) | |
tree | fcca87bc48bd442275f135e3216acab269ef2873 /mm | |
parent | e46227bf3899eb21d738aa8ef2ec0f598dc70f7a (diff) | |
parent | ebb3f994dd92f8fb4d70c7541091216c1e10cb71 (diff) | |
download | linux-f87bcc88f3028af584b0820bdf6e0e4cdc759d26.tar.bz2 |
Merge branch 'akpm' (patches from Andrew)
Merge misc mm fixes from Andrew Morton:
"2 patches.
Subsystems affected by this patch series: mm (userfaultfd and damon)"
* akpm:
mm/damon/dbgfs: fix 'struct pid' leaks in 'dbgfs_target_ids_write()'
userfaultfd/selftests: fix hugetlb area allocations
Diffstat (limited to 'mm')
-rw-r--r-- | mm/damon/dbgfs.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/mm/damon/dbgfs.c b/mm/damon/dbgfs.c index 4fbd729edc9e..ad65436756af 100644 --- a/mm/damon/dbgfs.c +++ b/mm/damon/dbgfs.c @@ -353,6 +353,7 @@ static ssize_t dbgfs_target_ids_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { struct damon_ctx *ctx = file->private_data; + struct damon_target *t, *next_t; bool id_is_pid = true; char *kbuf, *nrs; unsigned long *targets; @@ -397,8 +398,12 @@ static ssize_t dbgfs_target_ids_write(struct file *file, goto unlock_out; } - /* remove targets with previously-set primitive */ - damon_set_targets(ctx, NULL, 0); + /* remove previously set targets */ + damon_for_each_target_safe(t, next_t, ctx) { + if (targetid_is_pid(ctx)) + put_pid((struct pid *)t->id); + damon_destroy_target(t); + } /* Configure the context for the address space type */ if (id_is_pid) |