summaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2017-12-01 18:01:09 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2018-01-05 11:54:36 -0500
commita713fd7f529e361d42aa9dcc511e3fd3016599fe (patch)
tree4b6d1775e6551f31841b6aa7df7ad48771bf31ec /ipc
parent9b20d7fc5250f50660c4dd4bea52e54e373b678d (diff)
tidy do_mq_open() up a bit
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'ipc')
-rw-r--r--ipc/mqueue.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index ce498ff906bb..9f05837a86a6 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -743,12 +743,11 @@ static int prepare_open(struct dentry *dentry, int oflag, int ro,
743static int do_mq_open(const char __user *u_name, int oflag, umode_t mode, 743static int do_mq_open(const char __user *u_name, int oflag, umode_t mode,
744 struct mq_attr *attr) 744 struct mq_attr *attr)
745{ 745{
746 struct path path; 746 struct vfsmount *mnt = current->nsproxy->ipc_ns->mq_mnt;
747 struct dentry *root = mnt->mnt_root;
747 struct filename *name; 748 struct filename *name;
749 struct path path;
748 int fd, error; 750 int fd, error;
749 struct ipc_namespace *ipc_ns = current->nsproxy->ipc_ns;
750 struct vfsmount *mnt = ipc_ns->mq_mnt;
751 struct dentry *root = mnt->mnt_root;
752 int ro; 751 int ro;
753 752
754 audit_mq_open(oflag, mode, attr); 753 audit_mq_open(oflag, mode, attr);
@@ -761,7 +760,6 @@ static int do_mq_open(const char __user *u_name, int oflag, umode_t mode,
761 goto out_putname; 760 goto out_putname;
762 761
763 ro = mnt_want_write(mnt); /* we'll drop it in any case */ 762 ro = mnt_want_write(mnt); /* we'll drop it in any case */
764 error = 0;
765 inode_lock(d_inode(root)); 763 inode_lock(d_inode(root));
766 path.dentry = lookup_one_len(name->name, root, strlen(name->name)); 764 path.dentry = lookup_one_len(name->name, root, strlen(name->name));
767 if (IS_ERR(path.dentry)) { 765 if (IS_ERR(path.dentry)) {
@@ -769,7 +767,6 @@ static int do_mq_open(const char __user *u_name, int oflag, umode_t mode,
769 goto out_putfd; 767 goto out_putfd;
770 } 768 }
771 path.mnt = mntget(mnt); 769 path.mnt = mntget(mnt);
772
773 error = prepare_open(path.dentry, oflag, ro, mode, name, attr); 770 error = prepare_open(path.dentry, oflag, ro, mode, name, attr);
774 if (!error) { 771 if (!error) {
775 struct file *file = dentry_open(&path, oflag, current_cred()); 772 struct file *file = dentry_open(&path, oflag, current_cred());