[RFC][PATCH 19/27] sys_faccessat() elevate writer count

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

 





Signed-off-by: Dave Hansen <haveblue@xxxxxxxxxx>
---

 lxc-dave/fs/open.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff -puN fs/open.c~elevate-writers-opens-part2-sys_faccessat2 fs/open.c
--- lxc/fs/open.c~elevate-writers-opens-part2-sys_faccessat2	2006-06-07 16:53:23.000000000 -0700
+++ lxc-dave/fs/open.c	2006-06-07 16:53:23.000000000 -0700
@@ -542,9 +542,21 @@ asmlinkage long sys_faccessat(int dfd, c
 
 	res = vfs_permission(&nd, mode);
 	/* SuS v2 requires we report a read only fs too */
-	if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode)
-	   && !special_file(nd.dentry->d_inode->i_mode))
+	if(res)
+		goto out_path_release;
+	if (!(mode & S_IWOTH))
+		goto out_path_release;
+	if (special_file(nd.dentry->d_inode->i_mode))
+		goto out_path_release;
+
+	res = mnt_want_write(nd.mnt);
+	if (res) {
+		mnt_drop_write(nd.mnt);
+		goto out_path_release;
+	}
+	if (IS_RDONLY(nd.dentry->d_inode))
 		res = -EROFS;
+out_path_release:
 	path_release(&nd);
 
 out:
_
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux