Skip to content

Commit a713fd7

Browse files
author
Al Viro
committed
tidy do_mq_open() up a bit
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 9b20d7f commit a713fd7

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

‎ipc/mqueue.c‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -743,12 +743,11 @@ static int prepare_open(struct dentry *dentry, int oflag, int ro,
743743
static int do_mq_open(const char __user *u_name, int oflag, umode_t mode,
744744
struct mq_attr *attr)
745745
{
746-
struct path path;
746+
struct vfsmount *mnt = current->nsproxy->ipc_ns->mq_mnt;
747+
struct dentry *root = mnt->mnt_root;
747748
struct filename *name;
749+
struct path path;
748750
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;
752751
int ro;
753752

754753
audit_mq_open(oflag, mode, attr);
@@ -761,15 +760,13 @@ static int do_mq_open(const char __user *u_name, int oflag, umode_t mode,
761760
goto out_putname;
762761

763762
ro = mnt_want_write(mnt); /* we'll drop it in any case */
764-
error = 0;
765763
inode_lock(d_inode(root));
766764
path.dentry = lookup_one_len(name->name, root, strlen(name->name));
767765
if (IS_ERR(path.dentry)) {
768766
error = PTR_ERR(path.dentry);
769767
goto out_putfd;
770768
}
771769
path.mnt = mntget(mnt);
772-
773770
error = prepare_open(path.dentry, oflag, ro, mode, name, attr);
774771
if (!error) {
775772
struct file *file = dentry_open(&path, oflag, current_cred());

0 commit comments

Comments
 (0)