[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20071012160600.15119.80980.stgit@warthog.procyon.org.uk>
Date: Fri, 12 Oct 2007 17:06:00 +0100
From: David Howells <dhowells@...hat.com>
To: viro@....linux.org.uk
Cc: kwc@...i.umich.edu, Trond.Myklebust@...app.com,
linux-kernel@...r.kernel.org, dhowells@...hat.com
Subject: [PATCH 08/52] CRED: Pass credentials down to ext2 inode allocator
Pass credentials down to the ext2 inode allocator.
Signed-off-by: David Howells <dhowells@...hat.com>
---
fs/ext2/ext2.h | 2 +-
fs/ext2/ialloc.c | 6 +++---
fs/ext2/namei.c | 12 ++++++++----
3 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h
index 47d68aa..e6d3c3d 100644
--- a/fs/ext2/ext2.h
+++ b/fs/ext2/ext2.h
@@ -116,7 +116,7 @@ extern void ext2_set_link(struct inode *, struct ext2_dir_entry_2 *, struct page
extern int ext2_sync_file (struct file *, struct dentry *, int);
/* ialloc.c */
-extern struct inode * ext2_new_inode (struct inode *, int);
+extern struct inode * ext2_new_inode (struct inode *, int, struct cred *);
extern void ext2_free_inode (struct inode *);
extern unsigned long ext2_count_free_inodes (struct super_block *);
extern void ext2_check_inodes_bitmap (struct super_block *);
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
index 03b9287..8775a8e 100644
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -445,7 +445,7 @@ found:
return group;
}
-struct inode *ext2_new_inode(struct inode *dir, int mode)
+struct inode *ext2_new_inode(struct inode *dir, int mode, struct cred *cred)
{
struct super_block *sb;
struct buffer_head *bitmap_bh = NULL;
@@ -562,7 +562,7 @@ got:
sb->s_dirt = 1;
mark_buffer_dirty(bh2);
- inode->i_uid = current->cred->uid;
+ inode->i_uid = cred->uid;
if (test_opt (sb, GRPID))
inode->i_gid = dir->i_gid;
else if (dir->i_mode & S_ISGID) {
@@ -570,7 +570,7 @@ got:
if (S_ISDIR(mode))
mode |= S_ISGID;
} else
- inode->i_gid = current->cred->gid;
+ inode->i_gid = cred->gid;
inode->i_mode = mode;
inode->i_ino = ino;
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
index 80c97fd..821a2c3 100644
--- a/fs/ext2/namei.c
+++ b/fs/ext2/namei.c
@@ -105,7 +105,8 @@ struct dentry *ext2_get_parent(struct dentry *child)
*/
static int ext2_create (struct inode * dir, struct dentry * dentry, int mode, struct nameidata *nd)
{
- struct inode * inode = ext2_new_inode (dir, mode);
+ struct cred *cred = current->cred;
+ struct inode * inode = ext2_new_inode (dir, mode, cred);
int err = PTR_ERR(inode);
if (!IS_ERR(inode)) {
inode->i_op = &ext2_file_inode_operations;
@@ -127,13 +128,14 @@ static int ext2_create (struct inode * dir, struct dentry * dentry, int mode, st
static int ext2_mknod (struct inode * dir, struct dentry *dentry, int mode, dev_t rdev)
{
+ struct cred *cred = current->cred;
struct inode * inode;
int err;
if (!new_valid_dev(rdev))
return -EINVAL;
- inode = ext2_new_inode (dir, mode);
+ inode = ext2_new_inode (dir, mode, cred);
err = PTR_ERR(inode);
if (!IS_ERR(inode)) {
init_special_inode(inode, inode->i_mode, rdev);
@@ -149,6 +151,7 @@ static int ext2_mknod (struct inode * dir, struct dentry *dentry, int mode, dev_
static int ext2_symlink (struct inode * dir, struct dentry * dentry,
const char * symname)
{
+ struct cred *cred = current->cred;
struct super_block * sb = dir->i_sb;
int err = -ENAMETOOLONG;
unsigned l = strlen(symname)+1;
@@ -157,7 +160,7 @@ static int ext2_symlink (struct inode * dir, struct dentry * dentry,
if (l > sb->s_blocksize)
goto out;
- inode = ext2_new_inode (dir, S_IFLNK | S_IRWXUGO);
+ inode = ext2_new_inode (dir, S_IFLNK | S_IRWXUGO, cred);
err = PTR_ERR(inode);
if (IS_ERR(inode))
goto out;
@@ -207,6 +210,7 @@ static int ext2_link (struct dentry * old_dentry, struct inode * dir,
static int ext2_mkdir(struct inode * dir, struct dentry * dentry, int mode)
{
+ struct cred *cred = current->cred;
struct inode * inode;
int err = -EMLINK;
@@ -215,7 +219,7 @@ static int ext2_mkdir(struct inode * dir, struct dentry * dentry, int mode)
inode_inc_link_count(dir);
- inode = ext2_new_inode (dir, S_IFDIR | mode);
+ inode = ext2_new_inode (dir, S_IFDIR | mode, cred);
err = PTR_ERR(inode);
if (IS_ERR(inode))
goto out_dir;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists