From e28b4c7ebe8090341ed32cee0182d63e5e1c2c1a Mon Sep 17 00:00:00 2001 From: Dave Hansen Date: Fri, 15 Feb 2008 14:37:55 -0800 Subject: [PATCH] --- yaml --- r: 90960 b: refs/heads/master c: 2f676cbc0d60ae806216c7a61c6971bd72dedde8 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/open.c | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 83afb973e7fb..eab11cff33ae 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 9ac9b8474c39c3ae2c2b37d8e1f08db8a9146124 +refs/heads/master: 2f676cbc0d60ae806216c7a61c6971bd72dedde8 diff --git a/trunk/fs/open.c b/trunk/fs/open.c index 4d690e33446f..e58382d57e72 100644 --- a/trunk/fs/open.c +++ b/trunk/fs/open.c @@ -459,8 +459,17 @@ asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode) if(res || !(mode & S_IWOTH) || special_file(nd.path.dentry->d_inode->i_mode)) goto out_path_release; - - if(IS_RDONLY(nd.path.dentry->d_inode)) + /* + * This is a rare case where using __mnt_is_readonly() + * is OK without a mnt_want/drop_write() pair. Since + * no actual write to the fs is performed here, we do + * not need to telegraph to that to anyone. + * + * By doing this, we accept that this access is + * inherently racy and know that the fs may change + * state before we even see this result. + */ + if (__mnt_is_readonly(nd.path.mnt)) res = -EROFS; out_path_release: