Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/viro/vfs-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (39 commits)
  [PATCH] fix RLIM_NOFILE handling
  [PATCH] get rid of corner case in dup3() entirely
  [PATCH] remove remaining namei_{32,64}.h crap
  [PATCH] get rid of indirect users of namei.h
  [PATCH] get rid of __user_path_lookup_open
  [PATCH] f_count may wrap around
  [PATCH] dup3 fix
  [PATCH] don't pass nameidata to __ncp_lookup_validate()
  [PATCH] don't pass nameidata to gfs2_lookupi()
  [PATCH] new (local) helper: user_path_parent()
  [PATCH] sanitize __user_walk_fd() et.al.
  [PATCH] preparation to __user_walk_fd cleanup
  [PATCH] kill nameidata passing to permission(), rename to inode_permission()
  [PATCH] take noexec checks to very few callers that care
  Re: [PATCH 3/6] vfs: open_exec cleanup
  [patch 4/4] vfs: immutable inode checking cleanup
  [patch 3/4] fat: dont call notify_change
  [patch 2/4] vfs: utimes cleanup
  [patch 1/4] vfs: utimes: move owner check into inode_change_ok()
  [PATCH] vfs: use kstrdup() and check failing allocation
  ...
  • Loading branch information
Linus Torvalds committed Jul 27, 2008
2 parents 5c7c204 + 4e1e018 commit 4836e30
Show file tree
Hide file tree
Showing 126 changed files with 1,088 additions and 1,535 deletions.
10 changes: 5 additions & 5 deletions arch/alpha/kernel/osf_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,15 +253,15 @@ do_osf_statfs(struct dentry * dentry, struct osf_statfs __user *buffer,
}

asmlinkage int
osf_statfs(char __user *path, struct osf_statfs __user *buffer, unsigned long bufsiz)
osf_statfs(char __user *pathname, struct osf_statfs __user *buffer, unsigned long bufsiz)
{
struct nameidata nd;
struct path path;
int retval;

retval = user_path_walk(path, &nd);
retval = user_path(pathname, &path);
if (!retval) {
retval = do_osf_statfs(nd.path.dentry, buffer, bufsiz);
path_put(&nd.path);
retval = do_osf_statfs(path.dentry, buffer, bufsiz);
path_put(&path);
}
return retval;
}
Expand Down
10 changes: 5 additions & 5 deletions arch/parisc/hpux/sys_hpux.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,19 +210,19 @@ static int vfs_statfs_hpux(struct dentry *dentry, struct hpux_statfs *buf)
}

/* hpux statfs */
asmlinkage long hpux_statfs(const char __user *path,
asmlinkage long hpux_statfs(const char __user *pathname,
struct hpux_statfs __user *buf)
{
struct nameidata nd;
struct path path;
int error;

error = user_path_walk(path, &nd);
error = user_path(pathname, &path);
if (!error) {
struct hpux_statfs tmp;
error = vfs_statfs_hpux(nd.path.dentry, &tmp);
error = vfs_statfs_hpux(path.dentry, &tmp);
if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
error = -EFAULT;
path_put(&nd.path);
path_put(&path);
}
return error;
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/net/ppp_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,12 +581,12 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
if (file == ppp->owner)
ppp_shutdown_interface(ppp);
}
if (atomic_read(&file->f_count) <= 2) {
if (atomic_long_read(&file->f_count) <= 2) {
ppp_release(NULL, file);
err = 0;
} else
printk(KERN_DEBUG "PPPIOCDETACH file->f_count=%d\n",
atomic_read(&file->f_count));
printk(KERN_DEBUG "PPPIOCDETACH file->f_count=%ld\n",
atomic_long_read(&file->f_count));
unlock_kernel();
return err;
}
Expand Down
4 changes: 0 additions & 4 deletions fs/affs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ const struct inode_operations affs_file_inode_operations = {
static int
affs_file_open(struct inode *inode, struct file *filp)
{
if (atomic_read(&filp->f_count) != 1)
return 0;
pr_debug("AFFS: open(%lu,%d)\n",
inode->i_ino, atomic_read(&AFFS_I(inode)->i_opencnt));
atomic_inc(&AFFS_I(inode)->i_opencnt);
Expand All @@ -57,8 +55,6 @@ affs_file_open(struct inode *inode, struct file *filp)
static int
affs_file_release(struct inode *inode, struct file *filp)
{
if (atomic_read(&filp->f_count) != 0)
return 0;
pr_debug("AFFS: release(%lu, %d)\n",
inode->i_ino, atomic_read(&AFFS_I(inode)->i_opencnt));

Expand Down
4 changes: 1 addition & 3 deletions fs/afs/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,6 @@ extern bool afs_cm_incoming_call(struct afs_call *);
extern const struct inode_operations afs_dir_inode_operations;
extern const struct file_operations afs_dir_file_operations;

extern int afs_permission(struct inode *, int, struct nameidata *);

/*
* file.c
*/
Expand Down Expand Up @@ -605,7 +603,7 @@ extern void afs_clear_permits(struct afs_vnode *);
extern void afs_cache_permit(struct afs_vnode *, struct key *, long);
extern void afs_zap_permits(struct rcu_head *);
extern struct key *afs_request_key(struct afs_cell *);
extern int afs_permission(struct inode *, int, struct nameidata *);
extern int afs_permission(struct inode *, int);

/*
* server.c
Expand Down
2 changes: 1 addition & 1 deletion fs/afs/security.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ static int afs_check_permit(struct afs_vnode *vnode, struct key *key,
* - AFS ACLs are attached to directories only, and a file is controlled by its
* parent directory's ACL
*/
int afs_permission(struct inode *inode, int mask, struct nameidata *nd)
int afs_permission(struct inode *inode, int mask)
{
struct afs_vnode *vnode = AFS_FS_I(inode);
afs_access_t uninitialized_var(access);
Expand Down
6 changes: 3 additions & 3 deletions fs/aio.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,8 @@ static void aio_fput_routine(struct work_struct *data)
*/
static int __aio_put_req(struct kioctx *ctx, struct kiocb *req)
{
dprintk(KERN_DEBUG "aio_put(%p): f_count=%d\n",
req, atomic_read(&req->ki_filp->f_count));
dprintk(KERN_DEBUG "aio_put(%p): f_count=%ld\n",
req, atomic_long_read(&req->ki_filp->f_count));

assert_spin_locked(&ctx->ctx_lock);

Expand All @@ -528,7 +528,7 @@ static int __aio_put_req(struct kioctx *ctx, struct kiocb *req)
/* Must be done under the lock to serialise against cancellation.
* Call this aio_fput as it duplicates fput via the fput_work.
*/
if (unlikely(atomic_dec_and_test(&req->ki_filp->f_count))) {
if (unlikely(atomic_long_dec_and_test(&req->ki_filp->f_count))) {
get_ioctx(ctx);
spin_lock(&fput_lock);
list_add(&req->ki_list, &fput_head);
Expand Down
7 changes: 6 additions & 1 deletion fs/attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ int inode_change_ok(struct inode *inode, struct iattr *attr)
}

/* Check for setting the inode time. */
if (ia_valid & (ATTR_MTIME_SET | ATTR_ATIME_SET)) {
if (ia_valid & (ATTR_MTIME_SET | ATTR_ATIME_SET | ATTR_TIMES_SET)) {
if (!is_owner_or_cap(inode))
goto error;
}
Expand Down Expand Up @@ -108,6 +108,11 @@ int notify_change(struct dentry * dentry, struct iattr * attr)
struct timespec now;
unsigned int ia_valid = attr->ia_valid;

if (ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID | ATTR_TIMES_SET)) {
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
return -EPERM;
}

now = current_fs_time(inode->i_sb);

attr->ia_ctime = now;
Expand Down
3 changes: 1 addition & 2 deletions fs/bad_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,7 @@ static int bad_inode_readlink(struct dentry *dentry, char __user *buffer,
return -EIO;
}

static int bad_inode_permission(struct inode *inode, int mask,
struct nameidata *nd)
static int bad_inode_permission(struct inode *inode, int mask)
{
return -EIO;
}
Expand Down
2 changes: 1 addition & 1 deletion fs/cifs/cifsfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ cifs_statfs(struct dentry *dentry, struct kstatfs *buf)
return 0;
}

static int cifs_permission(struct inode *inode, int mask, struct nameidata *nd)
static int cifs_permission(struct inode *inode, int mask)
{
struct cifs_sb_info *cifs_sb;

Expand Down
4 changes: 3 additions & 1 deletion fs/coda/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,11 @@ static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, struc
}


int coda_permission(struct inode *inode, int mask, struct nameidata *nd)
int coda_permission(struct inode *inode, int mask)
{
int error = 0;

mask &= MAY_READ | MAY_WRITE | MAY_EXEC;

if (!mask)
return 0;
Expand Down
20 changes: 9 additions & 11 deletions fs/coda/pioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
#include <linux/coda_psdev.h>

/* pioctl ops */
static int coda_ioctl_permission(struct inode *inode, int mask,
struct nameidata *nd);
static int coda_ioctl_permission(struct inode *inode, int mask);
static int coda_pioctl(struct inode * inode, struct file * filp,
unsigned int cmd, unsigned long user_data);

Expand All @@ -42,16 +41,15 @@ const struct file_operations coda_ioctl_operations = {
};

/* the coda pioctl inode ops */
static int coda_ioctl_permission(struct inode *inode, int mask,
struct nameidata *nd)
static int coda_ioctl_permission(struct inode *inode, int mask)
{
return 0;
}

static int coda_pioctl(struct inode * inode, struct file * filp,
unsigned int cmd, unsigned long user_data)
{
struct nameidata nd;
struct path path;
int error;
struct PioctlData data;
struct inode *target_inode = NULL;
Expand All @@ -66,21 +64,21 @@ static int coda_pioctl(struct inode * inode, struct file * filp,
* Look up the pathname. Note that the pathname is in
* user memory, and namei takes care of this
*/
if ( data.follow ) {
error = user_path_walk(data.path, &nd);
if (data.follow) {
error = user_path(data.path, &path);
} else {
error = user_path_walk_link(data.path, &nd);
error = user_lpath(data.path, &path);
}

if ( error ) {
return error;
} else {
target_inode = nd.path.dentry->d_inode;
target_inode = path.dentry->d_inode;
}

/* return if it is not a Coda inode */
if ( target_inode->i_sb != inode->i_sb ) {
path_put(&nd.path);
path_put(&path);
return -EINVAL;
}

Expand All @@ -89,7 +87,7 @@ static int coda_pioctl(struct inode * inode, struct file * filp,

error = venus_pioctl(inode->i_sb, &(cnp->c_fid), cmd, &data);

path_put(&nd.path);
path_put(&path);
return error;
}

20 changes: 10 additions & 10 deletions fs/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,18 +234,18 @@ static int put_compat_statfs(struct compat_statfs __user *ubuf, struct kstatfs *
* The following statfs calls are copies of code from fs/open.c and
* should be checked against those from time to time
*/
asmlinkage long compat_sys_statfs(const char __user *path, struct compat_statfs __user *buf)
asmlinkage long compat_sys_statfs(const char __user *pathname, struct compat_statfs __user *buf)
{
struct nameidata nd;
struct path path;
int error;

error = user_path_walk(path, &nd);
error = user_path(pathname, &path);
if (!error) {
struct kstatfs tmp;
error = vfs_statfs(nd.path.dentry, &tmp);
error = vfs_statfs(path.dentry, &tmp);
if (!error)
error = put_compat_statfs(buf, &tmp);
path_put(&nd.path);
path_put(&path);
}
return error;
}
Expand Down Expand Up @@ -299,21 +299,21 @@ static int put_compat_statfs64(struct compat_statfs64 __user *ubuf, struct kstat
return 0;
}

asmlinkage long compat_sys_statfs64(const char __user *path, compat_size_t sz, struct compat_statfs64 __user *buf)
asmlinkage long compat_sys_statfs64(const char __user *pathname, compat_size_t sz, struct compat_statfs64 __user *buf)
{
struct nameidata nd;
struct path path;
int error;

if (sz != sizeof(*buf))
return -EINVAL;

error = user_path_walk(path, &nd);
error = user_path(pathname, &path);
if (!error) {
struct kstatfs tmp;
error = vfs_statfs(nd.path.dentry, &tmp);
error = vfs_statfs(path.dentry, &tmp);
if (!error)
error = put_compat_statfs64(buf, &tmp);
path_put(&nd.path);
path_put(&path);
}
return error;
}
Expand Down
21 changes: 3 additions & 18 deletions fs/ecryptfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,15 +465,13 @@ static int ecryptfs_symlink(struct inode *dir, struct dentry *dentry,
int rc;
struct dentry *lower_dentry;
struct dentry *lower_dir_dentry;
umode_t mode;
char *encoded_symname;
int encoded_symlen;
struct ecryptfs_crypt_stat *crypt_stat = NULL;

lower_dentry = ecryptfs_dentry_to_lower(dentry);
dget(lower_dentry);
lower_dir_dentry = lock_parent(lower_dentry);
mode = S_IALLUGO;
encoded_symlen = ecryptfs_encode_filename(crypt_stat, symname,
strlen(symname),
&encoded_symname);
Expand All @@ -482,7 +480,7 @@ static int ecryptfs_symlink(struct inode *dir, struct dentry *dentry,
goto out_lock;
}
rc = vfs_symlink(lower_dir_dentry->d_inode, lower_dentry,
encoded_symname, mode);
encoded_symname);
kfree(encoded_symname);
if (rc || !lower_dentry->d_inode)
goto out_lock;
Expand Down Expand Up @@ -830,22 +828,9 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length)
}

static int
ecryptfs_permission(struct inode *inode, int mask, struct nameidata *nd)
ecryptfs_permission(struct inode *inode, int mask)
{
int rc;

if (nd) {
struct vfsmount *vfsmnt_save = nd->path.mnt;
struct dentry *dentry_save = nd->path.dentry;

nd->path.mnt = ecryptfs_dentry_to_lower_mnt(nd->path.dentry);
nd->path.dentry = ecryptfs_dentry_to_lower(nd->path.dentry);
rc = permission(ecryptfs_inode_to_lower(inode), mask, nd);
nd->path.mnt = vfsmnt_save;
nd->path.dentry = dentry_save;
} else
rc = permission(ecryptfs_inode_to_lower(inode), mask, NULL);
return rc;
return inode_permission(ecryptfs_inode_to_lower(inode), mask);
}

/**
Expand Down
Loading

0 comments on commit 4836e30

Please sign in to comment.