diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c index 2554d8835b480b9706067d1375559defecfbeae1..3fdccd99a9d973a13c90d7600d7511fe0965832e 100644 --- a/fs/sysfs/group.c +++ b/fs/sysfs/group.c @@ -41,7 +41,7 @@ static int create_files(struct kernfs_node *parent, struct kobject *kobj, if (grp->attrs) { for (i = 0, attr = grp->attrs; *attr && !error; i++, attr++) { - umode_t mode = 0; + umode_t mode = (*attr)->mode; /* * In update mode, we're changing the permissions or @@ -56,8 +56,7 @@ static int create_files(struct kernfs_node *parent, struct kobject *kobj, continue; } error = sysfs_add_file_mode_ns(parent, *attr, false, - (*attr)->mode | mode, - NULL); + mode, NULL); if (unlikely(error)) break; }