summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-09-12 09:07:00 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2018-09-18 07:41:24 +0200
commit494bb4f70f59715fd7c0577eb733f038b8f74e02 (patch)
treeac45d112d15d33329508658c2be62174f4e6573a
parent45a280f0b6cb32936c943f0904738ed13066ceca (diff)
downloadbarebox-494bb4f70f59715fd7c0577eb733f038b8f74e02.tar.gz
fs: devfs: fix r/w permissions
The real r/w flags were lost in the switch to dentry cache implementation. Restore them. Fixes: 9137c41915 ("fs: devfs: Switch to dentry cache implementation") Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--fs/devfs.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/devfs.c b/fs/devfs.c
index 84c619f..d2b8010 100644
--- a/fs/devfs.c
+++ b/fs/devfs.c
@@ -251,10 +251,15 @@ static struct dentry *devfs_lookup(struct inode *dir, struct dentry *dentry,
if (!cdev)
return ERR_PTR(-ENOENT);
- inode = devfs_get_inode(dir->i_sb, dir, S_IFCHR | S_IRWXUGO);
+ inode = devfs_get_inode(dir->i_sb, dir, S_IFCHR);
if (!inode)
return ERR_PTR(-ENOMEM);
+ if (cdev->ops->write)
+ inode->i_mode |= S_IWUSR;
+ if (cdev->ops->read)
+ inode->i_mode |= S_IRUSR;
+
dinode = container_of(inode, struct devfs_inode, inode);
inode->i_size = cdev->size;