mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 2/2] fs: devfs: fix r/w permissions
Date: Wed, 12 Sep 2018 09:09:08 +0200	[thread overview]
Message-ID: <20180912070908.24485-2-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20180912070908.24485-1-s.hauer@pengutronix.de>

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>
---
 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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2018-09-12  7:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-12  7:09 [PATCH 1/2] fs: devfs: Create device files as character devices Sascha Hauer
2018-09-12  7:09 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180912070908.24485-2-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox