]> nv-tegra.nvidia Code Review - linux-2.6.git/blobdiff - fs/nfsctl.c
nfsd4: Fix filp leak
[linux-2.6.git] / fs / nfsctl.c
index b1acbd6ab6fb07c857b910f518a53736d8bd3631..124e8fcb0dd6ad1fbe55c166ec30019abdd9c410 100644 (file)
@@ -7,8 +7,6 @@
 #include <linux/types.h>
 #include <linux/file.h>
 #include <linux/fs.h>
-#include <linux/sunrpc/svc.h>
-#include <linux/nfsd/nfsd.h>
 #include <linux/nfsd/syscall.h>
 #include <linux/cred.h>
 #include <linux/sched.h>
 
 static struct file *do_open(char *name, int flags)
 {
-       struct nameidata nd;
        struct vfsmount *mnt;
-       int error;
+       struct file *file;
 
        mnt = do_kern_mount("nfsd", 0, "nfsd", NULL);
        if (IS_ERR(mnt))
                return (struct file *)mnt;
 
-       error = vfs_path_lookup(mnt->mnt_root, mnt, name, 0, &nd);
-       mntput(mnt);    /* drop do_kern_mount reference */
-       if (error)
-               return ERR_PTR(error);
-
-       if (flags == O_RDWR)
-               error = may_open(&nd,MAY_READ|MAY_WRITE,FMODE_READ|FMODE_WRITE);
-       else
-               error = may_open(&nd, MAY_WRITE, FMODE_WRITE);
+       file = file_open_root(mnt->mnt_root, mnt, name, flags);
 
-       if (!error)
-               return dentry_open(nd.path.dentry, nd.path.mnt, flags,
-                                  current_cred());
-
-       path_put(&nd.path);
-       return ERR_PTR(error);
+       mntput(mnt);    /* drop do_kern_mount reference */
+       return file;
 }
 
 static struct {
@@ -85,8 +70,8 @@ static struct {
        },
 };
 
-long
-asmlinkage sys_nfsservctl(int cmd, struct nfsctl_arg __user *arg, void __user *res)
+SYSCALL_DEFINE3(nfsservctl, int, cmd, struct nfsctl_arg __user *, arg,
+               void __user *, res)
 {
        struct file *file;
        void __user *p = &arg->u;