diff options
author | Andrew Morton <akpm@linux-foundation.org> | 2022-09-26 22:13:15 +0200 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2022-09-26 22:13:15 +0200 |
commit | 6d751329e761338faa9c24c2c9736f27bc54282b (patch) | |
tree | 6e1778a7448552c58d12da88f70f6ad2718d55da /mm/damon/dbgfs.c | |
parent | mm: fix PageAnonExclusive clearing racing with concurrent RCU GUP-fast (diff) | |
parent | x86/uaccess: avoid check_object_size() in copy_from_user_nmi() (diff) | |
download | linux-6d751329e761338faa9c24c2c9736f27bc54282b.tar.xz linux-6d751329e761338faa9c24c2c9736f27bc54282b.zip |
Merge branch 'mm-hotfixes-stable' into mm-stable
Diffstat (limited to 'mm/damon/dbgfs.c')
-rw-r--r-- | mm/damon/dbgfs.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/mm/damon/dbgfs.c b/mm/damon/dbgfs.c index 3b55a1b219b5..652a94deafe3 100644 --- a/mm/damon/dbgfs.c +++ b/mm/damon/dbgfs.c @@ -884,6 +884,7 @@ static int dbgfs_rm_context(char *name) struct dentry *root, *dir, **new_dirs; struct damon_ctx **new_ctxs; int i, j; + int ret = 0; if (damon_nr_running_ctxs()) return -EBUSY; @@ -898,14 +899,16 @@ static int dbgfs_rm_context(char *name) new_dirs = kmalloc_array(dbgfs_nr_ctxs - 1, sizeof(*dbgfs_dirs), GFP_KERNEL); - if (!new_dirs) - return -ENOMEM; + if (!new_dirs) { + ret = -ENOMEM; + goto out_dput; + } new_ctxs = kmalloc_array(dbgfs_nr_ctxs - 1, sizeof(*dbgfs_ctxs), GFP_KERNEL); if (!new_ctxs) { - kfree(new_dirs); - return -ENOMEM; + ret = -ENOMEM; + goto out_new_dirs; } for (i = 0, j = 0; i < dbgfs_nr_ctxs; i++) { @@ -925,7 +928,13 @@ static int dbgfs_rm_context(char *name) dbgfs_ctxs = new_ctxs; dbgfs_nr_ctxs--; - return 0; + goto out_dput; + +out_new_dirs: + kfree(new_dirs); +out_dput: + dput(dir); + return ret; } static ssize_t dbgfs_rm_context_write(struct file *file, |