aboutsummaryrefslogtreecommitdiffstats
path: root/fs/sysfs/group.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2015-11-25 10:56:40 -0800
committerTony Lindgren <tony@atomide.com>2015-11-25 10:56:40 -0800
commit970259bff472579204108c6f27036ec4d1206ae1 (patch)
tree869bdcda9aac4c67712d93e6141056fdf3f41bd8 /fs/sysfs/group.c
parentARM: OMAP2+: remove custom abort handler for t410 (diff)
parentarm: omap2+: add missing HWMOD_NO_IDLEST in 81xx hwmod data (diff)
downloadlinux-dev-970259bff472579204108c6f27036ec4d1206ae1.tar.xz
linux-dev-970259bff472579204108c6f27036ec4d1206ae1.zip
Merge branch '81xx' into omap-for-v4.4/fixes
Diffstat (limited to 'fs/sysfs/group.c')
-rw-r--r--fs/sysfs/group.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c
index e1236594fffe..dc1358b5ec95 100644
--- a/fs/sysfs/group.c
+++ b/fs/sysfs/group.c
@@ -73,13 +73,26 @@ static int create_files(struct kernfs_node *parent, struct kobject *kobj,
}
if (grp->bin_attrs) {
- for (bin_attr = grp->bin_attrs; *bin_attr; bin_attr++) {
+ for (i = 0, bin_attr = grp->bin_attrs; *bin_attr; i++, bin_attr++) {
+ umode_t mode = (*bin_attr)->attr.mode;
+
if (update)
kernfs_remove_by_name(parent,
(*bin_attr)->attr.name);
+ if (grp->is_bin_visible) {
+ mode = grp->is_bin_visible(kobj, *bin_attr, i);
+ if (!mode)
+ continue;
+ }
+
+ WARN(mode & ~(SYSFS_PREALLOC | 0664),
+ "Attribute %s: Invalid permissions 0%o\n",
+ (*bin_attr)->attr.name, mode);
+
+ mode &= SYSFS_PREALLOC | 0664;
error = sysfs_add_file_mode_ns(parent,
&(*bin_attr)->attr, true,
- (*bin_attr)->attr.mode, NULL);
+ mode, NULL);
if (error)
break;
}