aboutsummaryrefslogtreecommitdiff
path: root/fs/configfs
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2018-12-21 09:57:36 +0000
committerMark Brown <broonie@kernel.org>2018-12-21 09:57:36 +0000
commit43603a35574c2e594f9e10a97a40874d1282dd7e (patch)
treea814e05e3d87e221339e4fc9b5e2bd202faee716 /fs/configfs
parent38f53ef7bce9f848946a2ad4874d715186e32144 (diff)
parent1b2dbf3c8689071ab54298f1f999f092bb0b2410 (diff)
Merge tag 'v4.9.145-rt124' into linux-linaro-lsk-v4.9-rt
Linux 4.9.145-rt124
Diffstat (limited to 'fs/configfs')
-rw-r--r--fs/configfs/dir.c11
-rw-r--r--fs/configfs/symlink.c2
2 files changed, 12 insertions, 1 deletions
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 56fb26127fef..d2a1a79fa324 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -1777,6 +1777,16 @@ void configfs_unregister_group(struct config_group *group)
struct dentry *dentry = group->cg_item.ci_dentry;
struct dentry *parent = group->cg_item.ci_parent->ci_dentry;
+ mutex_lock(&subsys->su_mutex);
+ if (!group->cg_item.ci_parent->ci_group) {
+ /*
+ * The parent has already been unlinked and detached
+ * due to a rmdir.
+ */
+ goto unlink_group;
+ }
+ mutex_unlock(&subsys->su_mutex);
+
inode_lock_nested(d_inode(parent), I_MUTEX_PARENT);
spin_lock(&configfs_dirent_lock);
configfs_detach_prep(dentry, NULL);
@@ -1791,6 +1801,7 @@ void configfs_unregister_group(struct config_group *group)
dput(dentry);
mutex_lock(&subsys->su_mutex);
+unlink_group:
unlink_group(group);
mutex_unlock(&subsys->su_mutex);
}
diff --git a/fs/configfs/symlink.c b/fs/configfs/symlink.c
index 314b4edac72b..fea6db1ee065 100644
--- a/fs/configfs/symlink.c
+++ b/fs/configfs/symlink.c
@@ -64,7 +64,7 @@ static void fill_item_path(struct config_item * item, char * buffer, int length)
/* back up enough to print this bus id with '/' */
length -= cur;
- strncpy(buffer + length,config_item_name(p),cur);
+ memcpy(buffer + length, config_item_name(p), cur);
*(buffer + --length) = '/';
}
}