kernel/mm/damon/dbgfs.c
.. .. @@ -785,6 +785,7 @@ 785 785 static int dbgfs_rm_context(char *name) 786 786 { 787 787 struct dentry *root, *dir, **new_dirs; 788 + struct inode *inode;788 789 struct damon_ctx **new_ctxs; 789 790 int i, j; 790 791 int ret = 0; .. .. @@ -800,6 +801,12 @@ 800 801 if (!dir) 801 802 return -ENOENT; 802 803 804 + inode = d_inode(dir);805 + if (!S_ISDIR(inode->i_mode)) {806 + ret = -EINVAL;807 + goto out_dput;808 + }809 +803 810 new_dirs = kmalloc_array(dbgfs_nr_ctxs - 1, sizeof(*dbgfs_dirs), 804 811 GFP_KERNEL); 805 812 if (!new_dirs) {