diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/kernfs/dir.c | 9 | ||||
-rw-r--r-- | fs/sysfs/dir.c | 3 | ||||
-rw-r--r-- | fs/sysfs/group.c | 3 |
3 files changed, 9 insertions, 6 deletions
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c index 6520066c49e..e55bb02f15a 100644 --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c @@ -639,22 +639,23 @@ void kernfs_destroy_root(struct kernfs_root *root) * kernfs_create_dir_ns - create a directory * @parent: parent in which to create a new directory * @name: name of the new directory + * @mode: mode of the new directory * @priv: opaque data associated with the new directory * @ns: optional namespace tag of the directory * * Returns the created node on success, ERR_PTR() value on failure. */ struct kernfs_node *kernfs_create_dir_ns(struct kernfs_node *parent, - const char *name, void *priv, - const void *ns) + const char *name, umode_t mode, + void *priv, const void *ns) { - umode_t mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO; struct kernfs_addrm_cxt acxt; struct kernfs_node *kn; int rc; /* allocate */ - kn = kernfs_new_node(kernfs_root(parent), name, mode, KERNFS_DIR); + kn = kernfs_new_node(kernfs_root(parent), name, mode | S_IFDIR, + KERNFS_DIR); if (!kn) return ERR_PTR(-ENOMEM); diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index aa007401bfc..ee0d761c317 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c @@ -73,7 +73,8 @@ int sysfs_create_dir_ns(struct kobject *kobj, const void *ns) if (!parent) return -ENOENT; - kn = kernfs_create_dir_ns(parent, kobject_name(kobj), kobj, ns); + kn = kernfs_create_dir_ns(parent, kobject_name(kobj), + S_IRWXU | S_IRUGO | S_IXUGO, kobj, ns); if (IS_ERR(kn)) { if (PTR_ERR(kn) == -EEXIST) sysfs_warn_dup(parent, kobject_name(kobj)); diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c index 4d00d399647..6b579387c67 100644 --- a/fs/sysfs/group.c +++ b/fs/sysfs/group.c @@ -100,7 +100,8 @@ static int internal_create_group(struct kobject *kobj, int update, return -EINVAL; } if (grp->name) { - kn = kernfs_create_dir(kobj->sd, grp->name, kobj); + kn = kernfs_create_dir(kobj->sd, grp->name, + S_IRWXU | S_IRUGO | S_IXUGO, kobj); if (IS_ERR(kn)) { if (PTR_ERR(kn) == -EEXIST) sysfs_warn_dup(kobj->sd, grp->name); |