2007-04-05 10:04:00 +00:00
|
|
|
From: Tony Jones <tonyj@suse.de>
|
|
|
|
Subject: Add a struct vfsmount parameter to vfs_unlink()
|
|
|
|
|
|
|
|
The vfsmount will be passed down to the LSM hook so that LSMs can compute
|
|
|
|
pathnames.
|
2007-01-10 06:33:09 +00:00
|
|
|
|
|
|
|
Signed-off-by: Tony Jones <tonyj@suse.de>
|
|
|
|
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
|
2007-04-03 12:04:05 +00:00
|
|
|
Signed-off-by: John Johansen <jjohansen@suse.de>
|
2007-01-10 06:33:09 +00:00
|
|
|
|
2007-04-05 10:04:00 +00:00
|
|
|
---
|
|
|
|
fs/ecryptfs/inode.c | 3 ++-
|
|
|
|
fs/namei.c | 4 ++--
|
|
|
|
fs/nfsd/nfs4recover.c | 2 +-
|
|
|
|
fs/nfsd/vfs.c | 2 +-
|
|
|
|
include/linux/fs.h | 2 +-
|
|
|
|
ipc/mqueue.c | 2 +-
|
|
|
|
6 files changed, 8 insertions(+), 7 deletions(-)
|
|
|
|
|
2007-02-07 11:54:51 +00:00
|
|
|
--- a/fs/ecryptfs/inode.c
|
|
|
|
+++ b/fs/ecryptfs/inode.c
|
2008-07-02 20:24:33 +00:00
|
|
|
@@ -424,11 +424,12 @@ static int ecryptfs_unlink(struct inode
|
2007-01-10 06:33:09 +00:00
|
|
|
{
|
|
|
|
int rc = 0;
|
|
|
|
struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry);
|
|
|
|
+ struct vfsmount *lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry);
|
|
|
|
struct inode *lower_dir_inode = ecryptfs_inode_to_lower(dir);
|
2008-07-02 20:24:33 +00:00
|
|
|
struct dentry *lower_dir_dentry;
|
2007-01-10 06:33:09 +00:00
|
|
|
|
2008-07-02 20:24:33 +00:00
|
|
|
lower_dir_dentry = lock_parent(lower_dentry);
|
2007-01-10 06:33:09 +00:00
|
|
|
- rc = vfs_unlink(lower_dir_inode, lower_dentry);
|
2007-01-17 07:12:32 +00:00
|
|
|
+ rc = vfs_unlink(lower_dir_inode, lower_dentry, lower_mnt);
|
2007-01-10 06:33:09 +00:00
|
|
|
if (rc) {
|
|
|
|
printk(KERN_ERR "Error in vfs_unlink; rc = [%d]\n", rc);
|
|
|
|
goto out_unlock;
|
2007-02-07 11:54:51 +00:00
|
|
|
--- a/fs/namei.c
|
|
|
|
+++ b/fs/namei.c
|
2008-07-02 20:24:33 +00:00
|
|
|
@@ -2308,7 +2308,7 @@ asmlinkage long sys_rmdir(const char __u
|
2007-01-10 06:33:09 +00:00
|
|
|
return do_rmdir(AT_FDCWD, pathname);
|
|
|
|
}
|
|
|
|
|
|
|
|
-int vfs_unlink(struct inode *dir, struct dentry *dentry)
|
2007-01-17 07:12:32 +00:00
|
|
|
+int vfs_unlink(struct inode *dir, struct dentry *dentry, struct vfsmount *mnt)
|
2007-01-10 06:33:09 +00:00
|
|
|
{
|
|
|
|
int error = may_delete(dir, dentry, 0);
|
|
|
|
|
2008-07-02 20:24:33 +00:00
|
|
|
@@ -2376,7 +2376,7 @@ static long do_unlinkat(int dfd, const c
|
|
|
|
error = mnt_want_write(nd.path.mnt);
|
|
|
|
if (error)
|
|
|
|
goto exit2;
|
|
|
|
- error = vfs_unlink(nd.path.dentry->d_inode, dentry);
|
|
|
|
+ error = vfs_unlink(nd.path.dentry->d_inode, dentry, nd.path.mnt);
|
|
|
|
mnt_drop_write(nd.path.mnt);
|
2007-01-10 06:33:09 +00:00
|
|
|
exit2:
|
|
|
|
dput(dentry);
|
2007-02-07 11:54:51 +00:00
|
|
|
--- a/fs/nfsd/nfs4recover.c
|
|
|
|
+++ b/fs/nfsd/nfs4recover.c
|
2008-07-02 20:24:33 +00:00
|
|
|
@@ -264,7 +264,7 @@ nfsd4_remove_clid_file(struct dentry *di
|
2007-01-10 06:33:09 +00:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
2007-02-01 05:28:52 +00:00
|
|
|
mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT);
|
2007-01-10 06:33:09 +00:00
|
|
|
- status = vfs_unlink(dir->d_inode, dentry);
|
2008-07-02 20:24:33 +00:00
|
|
|
+ status = vfs_unlink(dir->d_inode, dentry, rec_dir.path.mnt);
|
2007-01-10 06:33:09 +00:00
|
|
|
mutex_unlock(&dir->d_inode->i_mutex);
|
|
|
|
return status;
|
|
|
|
}
|
2007-02-07 11:54:51 +00:00
|
|
|
--- a/fs/nfsd/vfs.c
|
|
|
|
+++ b/fs/nfsd/vfs.c
|
2008-07-02 20:24:33 +00:00
|
|
|
@@ -1811,7 +1811,7 @@ nfsd_unlink(struct svc_rqst *rqstp, stru
|
2007-01-10 06:33:09 +00:00
|
|
|
host_err = -EPERM;
|
|
|
|
} else
|
|
|
|
#endif
|
|
|
|
- host_err = vfs_unlink(dirp, rdentry);
|
2008-07-02 20:24:33 +00:00
|
|
|
+ host_err = vfs_unlink(dirp, rdentry, exp->ex_path.mnt);
|
2007-01-10 06:33:09 +00:00
|
|
|
} else { /* It's RMDIR */
|
2008-07-02 20:24:33 +00:00
|
|
|
host_err = vfs_rmdir(dirp, rdentry, exp->ex_path.mnt);
|
2007-01-10 06:33:09 +00:00
|
|
|
}
|
2007-02-07 11:54:51 +00:00
|
|
|
--- a/include/linux/fs.h
|
|
|
|
+++ b/include/linux/fs.h
|
2008-07-02 20:24:33 +00:00
|
|
|
@@ -1128,7 +1128,7 @@ extern int vfs_mknod(struct inode *, str
|
2007-01-17 07:12:32 +00:00
|
|
|
extern int vfs_symlink(struct inode *, struct dentry *, struct vfsmount *, const char *, int);
|
|
|
|
extern int vfs_link(struct dentry *, struct vfsmount *, struct inode *, struct dentry *, struct vfsmount *);
|
|
|
|
extern int vfs_rmdir(struct inode *, struct dentry *, struct vfsmount *);
|
2007-01-10 06:33:09 +00:00
|
|
|
-extern int vfs_unlink(struct inode *, struct dentry *);
|
2007-01-17 07:12:32 +00:00
|
|
|
+extern int vfs_unlink(struct inode *, struct dentry *, struct vfsmount *);
|
2007-01-10 06:33:09 +00:00
|
|
|
extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
|
|
|
|
|
|
|
|
/*
|
2007-02-07 11:54:51 +00:00
|
|
|
--- a/ipc/mqueue.c
|
|
|
|
+++ b/ipc/mqueue.c
|
2008-07-02 20:24:33 +00:00
|
|
|
@@ -756,7 +756,7 @@ asmlinkage long sys_mq_unlink(const char
|
|
|
|
err = mnt_want_write(mqueue_mnt);
|
|
|
|
if (err)
|
|
|
|
goto out_err;
|
2007-01-10 06:33:09 +00:00
|
|
|
- err = vfs_unlink(dentry->d_parent->d_inode, dentry);
|
2007-01-17 07:12:32 +00:00
|
|
|
+ err = vfs_unlink(dentry->d_parent->d_inode, dentry, mqueue_mnt);
|
2008-07-02 20:24:33 +00:00
|
|
|
mnt_drop_write(mqueue_mnt);
|
2007-01-10 06:33:09 +00:00
|
|
|
out_err:
|
|
|
|
dput(dentry);
|