2007-01-10 06:33:09 +00:00
|
|
|
Pass struct vfsmount to the inode_unlink LSM hook
|
|
|
|
|
|
|
|
Signed-off-by: Tony Jones <tonyj@suse.de>
|
|
|
|
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
|
|
|
|
|
|
|
|
Index: linux-2.6.19/fs/namei.c
|
|
|
|
===================================================================
|
|
|
|
--- linux-2.6.19.orig/fs/namei.c
|
|
|
|
+++ linux-2.6.19/fs/namei.c
|
|
|
|
@@ -2106,7 +2106,7 @@ int vfs_unlink(struct inode *dir, struct
|
|
|
|
if (d_mountpoint(dentry))
|
|
|
|
error = -EBUSY;
|
|
|
|
else {
|
|
|
|
- error = security_inode_unlink(dir, dentry);
|
2007-01-17 07:12:32 +00:00
|
|
|
+ error = security_inode_unlink(dir, dentry, mnt);
|
2007-01-10 06:33:09 +00:00
|
|
|
if (!error)
|
|
|
|
error = dir->i_op->unlink(dir, dentry);
|
|
|
|
}
|
|
|
|
Index: linux-2.6.19/include/linux/security.h
|
|
|
|
===================================================================
|
|
|
|
--- linux-2.6.19.orig/include/linux/security.h
|
|
|
|
+++ linux-2.6.19/include/linux/security.h
|
2007-01-17 07:12:32 +00:00
|
|
|
@@ -298,6 +298,7 @@ struct request_sock;
|
2007-01-10 06:33:09 +00:00
|
|
|
* Check the permission to remove a hard link to a file.
|
|
|
|
* @dir contains the inode structure of parent directory of the file.
|
|
|
|
* @dentry contains the dentry structure for file to be unlinked.
|
2007-01-17 07:12:32 +00:00
|
|
|
+ * @mnt is the vfsmount where the dentry was looked up (may be NULL)
|
2007-01-10 06:33:09 +00:00
|
|
|
* Return 0 if permission is granted.
|
|
|
|
* @inode_symlink:
|
2007-01-17 07:12:32 +00:00
|
|
|
* Check the permission to create a symbolic link to a file.
|
2007-01-10 06:33:09 +00:00
|
|
|
@@ -1226,7 +1227,8 @@ struct security_operations {
|
2007-01-17 07:12:32 +00:00
|
|
|
int (*inode_link) (struct dentry *old_dentry, struct vfsmount *old_mnt,
|
|
|
|
struct inode *dir, struct dentry *new_dentry,
|
|
|
|
struct vfsmount *new_mnt);
|
2007-01-10 06:33:09 +00:00
|
|
|
- int (*inode_unlink) (struct inode *dir, struct dentry *dentry);
|
2007-01-17 07:12:32 +00:00
|
|
|
+ int (*inode_unlink) (struct inode *dir, struct dentry *dentry,
|
|
|
|
+ struct vfsmount *mnt);
|
|
|
|
int (*inode_symlink) (struct inode *dir, struct dentry *dentry,
|
|
|
|
struct vfsmount *mnt, const char *old_name);
|
|
|
|
int (*inode_mkdir) (struct inode *dir, struct dentry *dentry,
|
2007-01-10 06:33:09 +00:00
|
|
|
@@ -1654,11 +1656,12 @@ static inline int security_inode_link (s
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int security_inode_unlink (struct inode *dir,
|
2007-01-17 07:12:32 +00:00
|
|
|
- struct dentry *dentry)
|
|
|
|
+ struct dentry *dentry,
|
|
|
|
+ struct vfsmount *mnt)
|
2007-01-10 06:33:09 +00:00
|
|
|
{
|
|
|
|
if (unlikely (IS_PRIVATE (dentry->d_inode)))
|
|
|
|
return 0;
|
|
|
|
- return security_ops->inode_unlink (dir, dentry);
|
2007-01-17 07:12:32 +00:00
|
|
|
+ return security_ops->inode_unlink (dir, dentry, mnt);
|
2007-01-10 06:33:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int security_inode_symlink (struct inode *dir,
|
2007-01-17 07:12:32 +00:00
|
|
|
@@ -2386,7 +2389,8 @@ static inline int security_inode_link (s
|
2007-01-10 06:33:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int security_inode_unlink (struct inode *dir,
|
2007-01-17 07:12:32 +00:00
|
|
|
- struct dentry *dentry)
|
|
|
|
+ struct dentry *dentry,
|
|
|
|
+ struct vfsmount *mnt)
|
2007-01-10 06:33:09 +00:00
|
|
|
{
|
|
|
|
return 0;
|
2007-01-17 07:12:32 +00:00
|
|
|
}
|
2007-01-10 06:33:09 +00:00
|
|
|
Index: linux-2.6.19/security/dummy.c
|
|
|
|
===================================================================
|
|
|
|
--- linux-2.6.19.orig/security/dummy.c
|
|
|
|
+++ linux-2.6.19/security/dummy.c
|
2007-01-17 07:12:32 +00:00
|
|
|
@@ -278,7 +278,8 @@ static int dummy_inode_link (struct dent
|
2007-01-10 06:33:09 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
-static int dummy_inode_unlink (struct inode *inode, struct dentry *dentry)
|
2007-01-17 07:12:32 +00:00
|
|
|
+static int dummy_inode_unlink (struct inode *inode, struct dentry *dentry,
|
|
|
|
+ struct vfsmount *mnt)
|
2007-01-10 06:33:09 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
Index: linux-2.6.19/security/selinux/hooks.c
|
|
|
|
===================================================================
|
|
|
|
--- linux-2.6.19.orig/security/selinux/hooks.c
|
|
|
|
+++ linux-2.6.19/security/selinux/hooks.c
|
2007-01-17 07:12:32 +00:00
|
|
|
@@ -2150,11 +2150,12 @@ static int selinux_inode_link(struct den
|
2007-01-10 06:33:09 +00:00
|
|
|
return may_link(dir, old_dentry, MAY_LINK);
|
|
|
|
}
|
|
|
|
|
|
|
|
-static int selinux_inode_unlink(struct inode *dir, struct dentry *dentry)
|
2007-01-17 07:12:32 +00:00
|
|
|
+static int selinux_inode_unlink(struct inode *dir, struct dentry *dentry,
|
|
|
|
+ struct vfsmount *mnt)
|
2007-01-10 06:33:09 +00:00
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
- rc = secondary_ops->inode_unlink(dir, dentry);
|
2007-01-17 07:12:32 +00:00
|
|
|
+ rc = secondary_ops->inode_unlink(dir, dentry, mnt);
|
2007-01-10 06:33:09 +00:00
|
|
|
if (rc)
|
|
|
|
return rc;
|
|
|
|
return may_link(dir, dentry, MAY_UNLINK);
|