Bind Mount Extensions 0.06
PATCH 3/6 Bind Mount Extensions 0.06
;
; Bind Mount Extensions
;
; This part propagates the vfsmount into chown_common() to allow ; vfsmount based checks there, and verifies that the vfsmount ; isn't RDONLY (in chown_common)
;
; Copyright (C) 2003-2005 Herbert Pötzl <[email protected]> ;
; Changelog:
;
; 0.01 - broken out part from bme0.05
;
; this patch is free software; you can redistribute it and/or ; modify it under the terms of the GNU General Public License ; as published by the Free Software Foundation; either version 2 ; of the License, or (at your option) any later version. ;
; this patch is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details.
;
fs/open.c +6 -5
@@ -661,7 +661,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;
@@ -673,7 +674,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))
@@ -703,7 +704,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;
@@ -716,7 +717,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;
@@ -730,7 +731,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;