]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/open.c
MMC: OMAP: Start new commands from work queue instead of irq
[linux-2.6-omap-h63xx.git] / fs / open.c
index ca8ac4bbd3bd8d8419467f61f510ed3a7e7bddec..3fa4e4ffce4cb4ba69862703f90d289731809eab 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -335,7 +335,7 @@ asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length)
 {
        long ret = do_sys_ftruncate(fd, length, 1);
        /* avoid REGPARM breakage on x86: */
-       prevent_tail_call(ret);
+       asmlinkage_protect(2, ret, fd, length);
        return ret;
 }
 
@@ -350,7 +350,7 @@ asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length)
 {
        long ret = do_sys_ftruncate(fd, length, 0);
        /* avoid REGPARM breakage on x86: */
-       prevent_tail_call(ret);
+       asmlinkage_protect(2, ret, fd, length);
        return ret;
 }
 #endif
@@ -490,7 +490,7 @@ asmlinkage long sys_chdir(const char __user * filename)
        if (error)
                goto dput_and_out;
 
-       set_fs_pwd(current->fs, nd.path.mnt, nd.path.dentry);
+       set_fs_pwd(current->fs, &nd.path);
 
 dput_and_out:
        path_put(&nd.path);
@@ -501,9 +501,7 @@ out:
 asmlinkage long sys_fchdir(unsigned int fd)
 {
        struct file *file;
-       struct dentry *dentry;
        struct inode *inode;
-       struct vfsmount *mnt;
        int error;
 
        error = -EBADF;
@@ -511,9 +509,7 @@ asmlinkage long sys_fchdir(unsigned int fd)
        if (!file)
                goto out;
 
-       dentry = file->f_path.dentry;
-       mnt = file->f_path.mnt;
-       inode = dentry->d_inode;
+       inode = file->f_path.dentry->d_inode;
 
        error = -ENOTDIR;
        if (!S_ISDIR(inode->i_mode))
@@ -521,7 +517,7 @@ asmlinkage long sys_fchdir(unsigned int fd)
 
        error = file_permission(file, MAY_EXEC);
        if (!error)
-               set_fs_pwd(current->fs, mnt, dentry);
+               set_fs_pwd(current->fs, &file->f_path);
 out_putf:
        fput(file);
 out:
@@ -545,7 +541,7 @@ asmlinkage long sys_chroot(const char __user * filename)
        if (!capable(CAP_SYS_CHROOT))
                goto dput_and_out;
 
-       set_fs_root(current->fs, nd.path.mnt, nd.path.dentry);
+       set_fs_root(current->fs, &nd.path);
        set_fs_altroot();
        error = 0;
 dput_and_out:
@@ -907,6 +903,18 @@ struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
        int error;
        struct file *f;
 
+       /*
+        * We must always pass in a valid mount pointer.   Historically
+        * callers got away with not passing it, but we must enforce this at
+        * the earliest possible point now to avoid strange problems deep in the
+        * filesystem stack.
+        */
+       if (!mnt) {
+               printk(KERN_WARNING "%s called with NULL vfsmount\n", __func__);
+               dump_stack();
+               return ERR_PTR(-EINVAL);
+       }
+
        error = -ENFILE;
        f = get_empty_filp();
        if (f == NULL) {
@@ -1059,7 +1067,7 @@ asmlinkage long sys_open(const char __user *filename, int flags, int mode)
 
        ret = do_sys_open(AT_FDCWD, filename, flags, mode);
        /* avoid REGPARM breakage on x86: */
-       prevent_tail_call(ret);
+       asmlinkage_protect(3, ret, filename, flags, mode);
        return ret;
 }
 
@@ -1073,7 +1081,7 @@ asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
 
        ret = do_sys_open(dfd, filename, flags, mode);
        /* avoid REGPARM breakage on x86: */
-       prevent_tail_call(ret);
+       asmlinkage_protect(4, ret, dfd, filename, flags, mode);
        return ret;
 }