[PATCH 2/2] fs: devfs: fix r/w permissions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 fs/devfs.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/devfs.c b/fs/devfs.c
index 84c619f1ed..d2b801036e 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;
-- 
2.18.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux