Merge branch 'master' of git://git.infradead.org/users/eparis/selinux into next

This commit is contained in:
James Morris
2011-03-08 11:38:10 +11:00
52 changed files with 594 additions and 323 deletions
+7 -6
View File
@@ -90,13 +90,14 @@ static noinline int cow_file_range(struct inode *inode,
unsigned long *nr_written, int unlock); unsigned long *nr_written, int unlock);
static int btrfs_init_inode_security(struct btrfs_trans_handle *trans, static int btrfs_init_inode_security(struct btrfs_trans_handle *trans,
struct inode *inode, struct inode *dir) struct inode *inode, struct inode *dir,
const struct qstr *qstr)
{ {
int err; int err;
err = btrfs_init_acl(trans, inode, dir); err = btrfs_init_acl(trans, inode, dir);
if (!err) if (!err)
err = btrfs_xattr_security_init(trans, inode, dir); err = btrfs_xattr_security_init(trans, inode, dir, qstr);
return err; return err;
} }
@@ -4704,7 +4705,7 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry,
if (IS_ERR(inode)) if (IS_ERR(inode))
goto out_unlock; goto out_unlock;
err = btrfs_init_inode_security(trans, inode, dir); err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name);
if (err) { if (err) {
drop_inode = 1; drop_inode = 1;
goto out_unlock; goto out_unlock;
@@ -4765,7 +4766,7 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry,
if (IS_ERR(inode)) if (IS_ERR(inode))
goto out_unlock; goto out_unlock;
err = btrfs_init_inode_security(trans, inode, dir); err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name);
if (err) { if (err) {
drop_inode = 1; drop_inode = 1;
goto out_unlock; goto out_unlock;
@@ -4893,7 +4894,7 @@ static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
drop_on_err = 1; drop_on_err = 1;
err = btrfs_init_inode_security(trans, inode, dir); err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name);
if (err) if (err)
goto out_fail; goto out_fail;
@@ -7104,7 +7105,7 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry,
if (IS_ERR(inode)) if (IS_ERR(inode))
goto out_unlock; goto out_unlock;
err = btrfs_init_inode_security(trans, inode, dir); err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name);
if (err) { if (err) {
drop_inode = 1; drop_inode = 1;
goto out_unlock; goto out_unlock;
+4 -2
View File
@@ -370,7 +370,8 @@ int btrfs_removexattr(struct dentry *dentry, const char *name)
} }
int btrfs_xattr_security_init(struct btrfs_trans_handle *trans, int btrfs_xattr_security_init(struct btrfs_trans_handle *trans,
struct inode *inode, struct inode *dir) struct inode *inode, struct inode *dir,
const struct qstr *qstr)
{ {
int err; int err;
size_t len; size_t len;
@@ -378,7 +379,8 @@ int btrfs_xattr_security_init(struct btrfs_trans_handle *trans,
char *suffix; char *suffix;
char *name; char *name;
err = security_inode_init_security(inode, dir, &suffix, &value, &len); err = security_inode_init_security(inode, dir, qstr, &suffix, &value,
&len);
if (err) { if (err) {
if (err == -EOPNOTSUPP) if (err == -EOPNOTSUPP)
return 0; return 0;
+2 -1
View File
@@ -37,6 +37,7 @@ extern int btrfs_setxattr(struct dentry *dentry, const char *name,
extern int btrfs_removexattr(struct dentry *dentry, const char *name); extern int btrfs_removexattr(struct dentry *dentry, const char *name);
extern int btrfs_xattr_security_init(struct btrfs_trans_handle *trans, extern int btrfs_xattr_security_init(struct btrfs_trans_handle *trans,
struct inode *inode, struct inode *dir); struct inode *inode, struct inode *dir,
const struct qstr *qstr);
#endif /* __XATTR__ */ #endif /* __XATTR__ */
+1 -1
View File
@@ -110,7 +110,7 @@ extern struct ext2_dir_entry_2 * ext2_dotdot (struct inode *, struct page **);
extern void ext2_set_link(struct inode *, struct ext2_dir_entry_2 *, struct page *, struct inode *, int); extern void ext2_set_link(struct inode *, struct ext2_dir_entry_2 *, struct page *, struct inode *, int);
/* ialloc.c */ /* ialloc.c */
extern struct inode * ext2_new_inode (struct inode *, int); extern struct inode * ext2_new_inode (struct inode *, int, const struct qstr *);
extern void ext2_free_inode (struct inode *); extern void ext2_free_inode (struct inode *);
extern unsigned long ext2_count_free_inodes (struct super_block *); extern unsigned long ext2_count_free_inodes (struct super_block *);
extern void ext2_check_inodes_bitmap (struct super_block *); extern void ext2_check_inodes_bitmap (struct super_block *);
+3 -2
View File
@@ -429,7 +429,8 @@ found:
return group; return group;
} }
struct inode *ext2_new_inode(struct inode *dir, int mode) struct inode *ext2_new_inode(struct inode *dir, int mode,
const struct qstr *qstr)
{ {
struct super_block *sb; struct super_block *sb;
struct buffer_head *bitmap_bh = NULL; struct buffer_head *bitmap_bh = NULL;
@@ -585,7 +586,7 @@ got:
if (err) if (err)
goto fail_free_drop; goto fail_free_drop;
err = ext2_init_security(inode,dir); err = ext2_init_security(inode, dir, qstr);
if (err) if (err)
goto fail_free_drop; goto fail_free_drop;
+4 -4
View File
@@ -104,7 +104,7 @@ static int ext2_create (struct inode * dir, struct dentry * dentry, int mode, st
dquot_initialize(dir); dquot_initialize(dir);
inode = ext2_new_inode(dir, mode); inode = ext2_new_inode(dir, mode, &dentry->d_name);
if (IS_ERR(inode)) if (IS_ERR(inode))
return PTR_ERR(inode); return PTR_ERR(inode);
@@ -133,7 +133,7 @@ static int ext2_mknod (struct inode * dir, struct dentry *dentry, int mode, dev_
dquot_initialize(dir); dquot_initialize(dir);
inode = ext2_new_inode (dir, mode); inode = ext2_new_inode (dir, mode, &dentry->d_name);
err = PTR_ERR(inode); err = PTR_ERR(inode);
if (!IS_ERR(inode)) { if (!IS_ERR(inode)) {
init_special_inode(inode, inode->i_mode, rdev); init_special_inode(inode, inode->i_mode, rdev);
@@ -159,7 +159,7 @@ static int ext2_symlink (struct inode * dir, struct dentry * dentry,
dquot_initialize(dir); dquot_initialize(dir);
inode = ext2_new_inode (dir, S_IFLNK | S_IRWXUGO); inode = ext2_new_inode (dir, S_IFLNK | S_IRWXUGO, &dentry->d_name);
err = PTR_ERR(inode); err = PTR_ERR(inode);
if (IS_ERR(inode)) if (IS_ERR(inode))
goto out; goto out;
@@ -230,7 +230,7 @@ static int ext2_mkdir(struct inode * dir, struct dentry * dentry, int mode)
inode_inc_link_count(dir); inode_inc_link_count(dir);
inode = ext2_new_inode (dir, S_IFDIR | mode); inode = ext2_new_inode(dir, S_IFDIR | mode, &dentry->d_name);
err = PTR_ERR(inode); err = PTR_ERR(inode);
if (IS_ERR(inode)) if (IS_ERR(inode))
goto out_dir; goto out_dir;
+4 -2
View File
@@ -116,9 +116,11 @@ exit_ext2_xattr(void)
# endif /* CONFIG_EXT2_FS_XATTR */ # endif /* CONFIG_EXT2_FS_XATTR */
#ifdef CONFIG_EXT2_FS_SECURITY #ifdef CONFIG_EXT2_FS_SECURITY
extern int ext2_init_security(struct inode *inode, struct inode *dir); extern int ext2_init_security(struct inode *inode, struct inode *dir,
const struct qstr *qstr);
#else #else
static inline int ext2_init_security(struct inode *inode, struct inode *dir) static inline int ext2_init_security(struct inode *inode, struct inode *dir,
const struct qstr *qstr)
{ {
return 0; return 0;
} }
+3 -2
View File
@@ -47,14 +47,15 @@ ext2_xattr_security_set(struct dentry *dentry, const char *name,
} }
int int
ext2_init_security(struct inode *inode, struct inode *dir) ext2_init_security(struct inode *inode, struct inode *dir,
const struct qstr *qstr)
{ {
int err; int err;
size_t len; size_t len;
void *value; void *value;
char *name; char *name;
err = security_inode_init_security(inode, dir, &name, &value, &len); err = security_inode_init_security(inode, dir, qstr, &name, &value, &len);
if (err) { if (err) {
if (err == -EOPNOTSUPP) if (err == -EOPNOTSUPP)
return 0; return 0;
+3 -2
View File
@@ -404,7 +404,8 @@ static int find_group_other(struct super_block *sb, struct inode *parent)
* For other inodes, search forward from the parent directory's block * For other inodes, search forward from the parent directory's block
* group to find a free inode. * group to find a free inode.
*/ */
struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode) struct inode *ext3_new_inode(handle_t *handle, struct inode * dir,
const struct qstr *qstr, int mode)
{ {
struct super_block *sb; struct super_block *sb;
struct buffer_head *bitmap_bh = NULL; struct buffer_head *bitmap_bh = NULL;
@@ -589,7 +590,7 @@ got:
if (err) if (err)
goto fail_free_drop; goto fail_free_drop;
err = ext3_init_security(handle,inode, dir); err = ext3_init_security(handle, inode, dir, qstr);
if (err) if (err)
goto fail_free_drop; goto fail_free_drop;
+4 -4
View File
@@ -1710,7 +1710,7 @@ retry:
if (IS_DIRSYNC(dir)) if (IS_DIRSYNC(dir))
handle->h_sync = 1; handle->h_sync = 1;
inode = ext3_new_inode (handle, dir, mode); inode = ext3_new_inode (handle, dir, &dentry->d_name, mode);
err = PTR_ERR(inode); err = PTR_ERR(inode);
if (!IS_ERR(inode)) { if (!IS_ERR(inode)) {
inode->i_op = &ext3_file_inode_operations; inode->i_op = &ext3_file_inode_operations;
@@ -1746,7 +1746,7 @@ retry:
if (IS_DIRSYNC(dir)) if (IS_DIRSYNC(dir))
handle->h_sync = 1; handle->h_sync = 1;
inode = ext3_new_inode (handle, dir, mode); inode = ext3_new_inode (handle, dir, &dentry->d_name, mode);
err = PTR_ERR(inode); err = PTR_ERR(inode);
if (!IS_ERR(inode)) { if (!IS_ERR(inode)) {
init_special_inode(inode, inode->i_mode, rdev); init_special_inode(inode, inode->i_mode, rdev);
@@ -1784,7 +1784,7 @@ retry:
if (IS_DIRSYNC(dir)) if (IS_DIRSYNC(dir))
handle->h_sync = 1; handle->h_sync = 1;
inode = ext3_new_inode (handle, dir, S_IFDIR | mode); inode = ext3_new_inode (handle, dir, &dentry->d_name, S_IFDIR | mode);
err = PTR_ERR(inode); err = PTR_ERR(inode);
if (IS_ERR(inode)) if (IS_ERR(inode))
goto out_stop; goto out_stop;
@@ -2206,7 +2206,7 @@ retry:
if (IS_DIRSYNC(dir)) if (IS_DIRSYNC(dir))
handle->h_sync = 1; handle->h_sync = 1;
inode = ext3_new_inode (handle, dir, S_IFLNK|S_IRWXUGO); inode = ext3_new_inode (handle, dir, &dentry->d_name, S_IFLNK|S_IRWXUGO);
err = PTR_ERR(inode); err = PTR_ERR(inode);
if (IS_ERR(inode)) if (IS_ERR(inode))
goto out_stop; goto out_stop;
+2 -2
View File
@@ -128,10 +128,10 @@ exit_ext3_xattr(void)
#ifdef CONFIG_EXT3_FS_SECURITY #ifdef CONFIG_EXT3_FS_SECURITY
extern int ext3_init_security(handle_t *handle, struct inode *inode, extern int ext3_init_security(handle_t *handle, struct inode *inode,
struct inode *dir); struct inode *dir, const struct qstr *qstr);
#else #else
static inline int ext3_init_security(handle_t *handle, struct inode *inode, static inline int ext3_init_security(handle_t *handle, struct inode *inode,
struct inode *dir) struct inode *dir, const struct qstr *qstr)
{ {
return 0; return 0;
} }
+3 -2
View File
@@ -49,14 +49,15 @@ ext3_xattr_security_set(struct dentry *dentry, const char *name,
} }
int int
ext3_init_security(handle_t *handle, struct inode *inode, struct inode *dir) ext3_init_security(handle_t *handle, struct inode *inode, struct inode *dir,
const struct qstr *qstr)
{ {
int err; int err;
size_t len; size_t len;
void *value; void *value;
char *name; char *name;
err = security_inode_init_security(inode, dir, &name, &value, &len); err = security_inode_init_security(inode, dir, qstr, &name, &value, &len);
if (err) { if (err) {
if (err == -EOPNOTSUPP) if (err == -EOPNOTSUPP)
return 0; return 0;
+1 -1
View File
@@ -1042,7 +1042,7 @@ got:
if (err) if (err)
goto fail_free_drop; goto fail_free_drop;
err = ext4_init_security(handle, inode, dir); err = ext4_init_security(handle, inode, dir, qstr);
if (err) if (err)
goto fail_free_drop; goto fail_free_drop;
+2 -2
View File
@@ -145,10 +145,10 @@ ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
#ifdef CONFIG_EXT4_FS_SECURITY #ifdef CONFIG_EXT4_FS_SECURITY
extern int ext4_init_security(handle_t *handle, struct inode *inode, extern int ext4_init_security(handle_t *handle, struct inode *inode,
struct inode *dir); struct inode *dir, const struct qstr *qstr);
#else #else
static inline int ext4_init_security(handle_t *handle, struct inode *inode, static inline int ext4_init_security(handle_t *handle, struct inode *inode,
struct inode *dir) struct inode *dir, const struct qstr *qstr)
{ {
return 0; return 0;
} }
+3 -2
View File
@@ -49,14 +49,15 @@ ext4_xattr_security_set(struct dentry *dentry, const char *name,
} }
int int
ext4_init_security(handle_t *handle, struct inode *inode, struct inode *dir) ext4_init_security(handle_t *handle, struct inode *inode, struct inode *dir,
const struct qstr *qstr)
{ {
int err; int err;
size_t len; size_t len;
void *value; void *value;
char *name; char *name;
err = security_inode_init_security(inode, dir, &name, &value, &len); err = security_inode_init_security(inode, dir, qstr, &name, &value, &len);
if (err) { if (err) {
if (err == -EOPNOTSUPP) if (err == -EOPNOTSUPP)
return 0; return 0;
+4 -3
View File
@@ -763,14 +763,15 @@ fail:
return error; return error;
} }
static int gfs2_security_init(struct gfs2_inode *dip, struct gfs2_inode *ip) static int gfs2_security_init(struct gfs2_inode *dip, struct gfs2_inode *ip,
const struct qstr *qstr)
{ {
int err; int err;
size_t len; size_t len;
void *value; void *value;
char *name; char *name;
err = security_inode_init_security(&ip->i_inode, &dip->i_inode, err = security_inode_init_security(&ip->i_inode, &dip->i_inode, qstr,
&name, &value, &len); &name, &value, &len);
if (err) { if (err) {
@@ -854,7 +855,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name,
if (error) if (error)
goto fail_gunlock2; goto fail_gunlock2;
error = gfs2_security_init(dip, GFS2_I(inode)); error = gfs2_security_init(dip, GFS2_I(inode), name);
if (error) if (error)
goto fail_gunlock2; goto fail_gunlock2;
+4 -5
View File
@@ -215,8 +215,7 @@ static int jffs2_create(struct inode *dir_i, struct dentry *dentry, int mode,
no chance of AB-BA deadlock involving its f->sem). */ no chance of AB-BA deadlock involving its f->sem). */
mutex_unlock(&f->sem); mutex_unlock(&f->sem);
ret = jffs2_do_create(c, dir_f, f, ri, ret = jffs2_do_create(c, dir_f, f, ri, &dentry->d_name);
dentry->d_name.name, dentry->d_name.len);
if (ret) if (ret)
goto fail; goto fail;
@@ -386,7 +385,7 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char
jffs2_complete_reservation(c); jffs2_complete_reservation(c);
ret = jffs2_init_security(inode, dir_i); ret = jffs2_init_security(inode, dir_i, &dentry->d_name);
if (ret) if (ret)
goto fail; goto fail;
@@ -530,7 +529,7 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, int mode)
jffs2_complete_reservation(c); jffs2_complete_reservation(c);
ret = jffs2_init_security(inode, dir_i); ret = jffs2_init_security(inode, dir_i, &dentry->d_name);
if (ret) if (ret)
goto fail; goto fail;
@@ -703,7 +702,7 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, int mode, de
jffs2_complete_reservation(c); jffs2_complete_reservation(c);
ret = jffs2_init_security(inode, dir_i); ret = jffs2_init_security(inode, dir_i, &dentry->d_name);
if (ret) if (ret)
goto fail; goto fail;
+1 -1
View File
@@ -401,7 +401,7 @@ int jffs2_write_inode_range(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
struct jffs2_raw_inode *ri, unsigned char *buf, struct jffs2_raw_inode *ri, unsigned char *buf,
uint32_t offset, uint32_t writelen, uint32_t *retlen); uint32_t offset, uint32_t writelen, uint32_t *retlen);
int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, struct jffs2_inode_info *f, int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, struct jffs2_inode_info *f,
struct jffs2_raw_inode *ri, const char *name, int namelen); struct jffs2_raw_inode *ri, const struct qstr *qstr);
int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, const char *name, int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, const char *name,
int namelen, struct jffs2_inode_info *dead_f, uint32_t time); int namelen, struct jffs2_inode_info *dead_f, uint32_t time);
int jffs2_do_link(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, uint32_t ino, int jffs2_do_link(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, uint32_t ino,
+3 -2
View File
@@ -23,14 +23,15 @@
#include "nodelist.h" #include "nodelist.h"
/* ---- Initial Security Label Attachment -------------- */ /* ---- Initial Security Label Attachment -------------- */
int jffs2_init_security(struct inode *inode, struct inode *dir) int jffs2_init_security(struct inode *inode, struct inode *dir,
const struct qstr *qstr)
{ {
int rc; int rc;
size_t len; size_t len;
void *value; void *value;
char *name; char *name;
rc = security_inode_init_security(inode, dir, &name, &value, &len); rc = security_inode_init_security(inode, dir, qstr, &name, &value, &len);
if (rc) { if (rc) {
if (rc == -EOPNOTSUPP) if (rc == -EOPNOTSUPP)
return 0; return 0;
+10 -8
View File
@@ -424,7 +424,9 @@ int jffs2_write_inode_range(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
return ret; return ret;
} }
int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, struct jffs2_inode_info *f, struct jffs2_raw_inode *ri, const char *name, int namelen) int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f,
struct jffs2_inode_info *f, struct jffs2_raw_inode *ri,
const struct qstr *qstr)
{ {
struct jffs2_raw_dirent *rd; struct jffs2_raw_dirent *rd;
struct jffs2_full_dnode *fn; struct jffs2_full_dnode *fn;
@@ -466,15 +468,15 @@ int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, str
mutex_unlock(&f->sem); mutex_unlock(&f->sem);
jffs2_complete_reservation(c); jffs2_complete_reservation(c);
ret = jffs2_init_security(&f->vfs_inode, &dir_f->vfs_inode); ret = jffs2_init_security(&f->vfs_inode, &dir_f->vfs_inode, qstr);
if (ret) if (ret)
return ret; return ret;
ret = jffs2_init_acl_post(&f->vfs_inode); ret = jffs2_init_acl_post(&f->vfs_inode);
if (ret) if (ret)
return ret; return ret;
ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &alloclen, ret = jffs2_reserve_space(c, sizeof(*rd)+qstr->len, &alloclen,
ALLOC_NORMAL, JFFS2_SUMMARY_DIRENT_SIZE(namelen)); ALLOC_NORMAL, JFFS2_SUMMARY_DIRENT_SIZE(qstr->len));
if (ret) { if (ret) {
/* Eep. */ /* Eep. */
@@ -493,19 +495,19 @@ int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, str
rd->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); rd->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
rd->nodetype = cpu_to_je16(JFFS2_NODETYPE_DIRENT); rd->nodetype = cpu_to_je16(JFFS2_NODETYPE_DIRENT);
rd->totlen = cpu_to_je32(sizeof(*rd) + namelen); rd->totlen = cpu_to_je32(sizeof(*rd) + qstr->len);
rd->hdr_crc = cpu_to_je32(crc32(0, rd, sizeof(struct jffs2_unknown_node)-4)); rd->hdr_crc = cpu_to_je32(crc32(0, rd, sizeof(struct jffs2_unknown_node)-4));
rd->pino = cpu_to_je32(dir_f->inocache->ino); rd->pino = cpu_to_je32(dir_f->inocache->ino);
rd->version = cpu_to_je32(++dir_f->highest_version); rd->version = cpu_to_je32(++dir_f->highest_version);
rd->ino = ri->ino; rd->ino = ri->ino;
rd->mctime = ri->ctime; rd->mctime = ri->ctime;
rd->nsize = namelen; rd->nsize = qstr->len;
rd->type = DT_REG; rd->type = DT_REG;
rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8)); rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8));
rd->name_crc = cpu_to_je32(crc32(0, name, namelen)); rd->name_crc = cpu_to_je32(crc32(0, qstr->name, qstr->len));
fd = jffs2_write_dirent(c, dir_f, rd, name, namelen, ALLOC_NORMAL); fd = jffs2_write_dirent(c, dir_f, rd, qstr->name, qstr->len, ALLOC_NORMAL);
jffs2_free_raw_dirent(rd); jffs2_free_raw_dirent(rd);

Some files were not shown because too many files have changed in this diff Show More