summaryrefslogtreecommitdiffstats
path: root/fs/devfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/devfs.c')
-rw-r--r--fs/devfs.c7
1 files changed, 6 insertions, 1 deletions
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;