All of lore.kernel.org
 help / color / mirror / Atom feed
From: Herbert Poetzl <herbert@13thfloor.at>
To: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>,
	Christoph Hellwig <hch@infradead.org>,
	Al Viro <viro@ftp.linux.org.uk>,
	Linux Kernel ML <linux-kernel@vger.kernel.org>
Subject: [PATCH 3/6] vfs: propagate vfsmount into chown_common()
Date: Sat, 21 Jan 2006 09:41:27 +0100	[thread overview]
Message-ID: <20060121084126.GD10044@MAIL.13thfloor.at> (raw)
In-Reply-To: <20060121083843.GA10044@MAIL.13thfloor.at>


;
; Bind Mount Extensions
;
; Copyright (C) 2003-2006 Herbert Pötzl <herbert@13thfloor.at>
;
; the vfsmount is propagated into chown_common() to allow
; for vfsmount based checks there, in this case the
; MNT_IS_RDONLY() check to disallow changes
;
;
; Changelog:
;
;   0.01  - broken out from bme0.05
;

Signed-off-by: Herbert Pötzl <herbert@13thfloor.at>

diff -NurpP --minimal linux-2.6.16-rc1/fs/open.c linux-2.6.16-rc1-bme0.06.2-cc0.01/fs/open.c
--- linux-2.6.16-rc1/fs/open.c	2006-01-18 06:08:34 +0100
+++ linux-2.6.16-rc1-bme0.06.2-cc0.01/fs/open.c	2006-01-21 09:08:38 +0100
@@ -669,7 +669,8 @@ out:
 	return error;
 }
 
-static int chown_common(struct dentry * dentry, uid_t user, gid_t group)
+static int chown_common(struct dentry *dentry, struct vfsmount *mnt,
+	uid_t user, gid_t group)
 {
 	struct inode * inode;
 	int error;
@@ -681,7 +682,7 @@ static int chown_common(struct dentry * 
 		goto out;
 	}
 	error = -EROFS;
-	if (IS_RDONLY(inode))
+	if (IS_RDONLY(inode) || MNT_IS_RDONLY(mnt))
 		goto out;
 	error = -EPERM;
 	if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
@@ -711,7 +712,7 @@ asmlinkage long sys_chown(const char __u
 
 	error = user_path_walk(filename, &nd);
 	if (!error) {
-		error = chown_common(nd.dentry, user, group);
+		error = chown_common(nd.dentry, nd.mnt, user, group);
 		path_release(&nd);
 	}
 	return error;
@@ -724,7 +725,7 @@ asmlinkage long sys_lchown(const char __
 
 	error = user_path_walk_link(filename, &nd);
 	if (!error) {
-		error = chown_common(nd.dentry, user, group);
+		error = chown_common(nd.dentry, nd.mnt, user, group);
 		path_release(&nd);
 	}
 	return error;
@@ -738,7 +739,7 @@ asmlinkage long sys_fchown(unsigned int 
 
 	file = fget(fd);
 	if (file) {
-		error = chown_common(file->f_dentry, user, group);
+		error = chown_common(file->f_dentry, file->f_vfsmnt, user, group);
 		fput(file);
 	}
 	return error;


  parent reply	other threads:[~2006-01-21  8:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-21  8:38 [PATCH 0/6] vfs: extend loopback (bind) mounts by mnt_flags Herbert Poetzl
2006-01-21  8:40 ` [PATCH 1/6] vfs: add missing MNT_RDONLY and macro to check Herbert Poetzl
2006-01-21  8:40 ` [PATCH 2/6] vfs: propagate mnt_flags into do_loopback/vfsmount Herbert Poetzl
2006-01-22 10:06   ` Suleiman Souhlal
2006-01-22 10:59     ` Suleiman Souhlal
2006-01-24 19:02   ` Christoph Hellwig
2006-01-26 21:04     ` Herbert Poetzl
2006-01-27 20:03     ` Herbert Poetzl
2006-04-01 17:02       ` Christoph Hellwig
2006-01-21  8:41 ` Herbert Poetzl [this message]
2006-01-21  8:42 ` [PATCH 4/6] vfs: propagate the nameidata into the relevant vfs_*() Herbert Poetzl
2006-01-21  8:43 ` [PATCH 5/6] vfs: propagate the vfsmount into *xattr() Herbert Poetzl
2006-01-21  8:43 ` [PATCH 6/6] vfs: extend IS_RDONLY() checks to MNT_IS_RDONLY() Herbert Poetzl
2006-01-24 19:06 ` [PATCH 0/6] vfs: extend loopback (bind) mounts by mnt_flags Christoph Hellwig
2006-01-26 21:08   ` Herbert Poetzl

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=20060121084126.GD10044@MAIL.13thfloor.at \
    --to=herbert@13thfloor.at \
    --cc=akpm@osdl.org \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    --cc=viro@ftp.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.