Skip to content

Commit

Permalink
mqueue: fix mq_open() file descriptor leak on user-space processes
Browse files Browse the repository at this point in the history
We leak fd on lookup_one_len() failure

Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
andre-rosa authored and Al Viro committed Mar 3, 2010
1 parent 4919c5e commit 4294a8e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions ipc/mqueue.c
Expand Up @@ -705,7 +705,7 @@ SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, mode_t, mode,
dentry = lookup_one_len(name, ipc_ns->mq_mnt->mnt_root, strlen(name));
if (IS_ERR(dentry)) {
error = PTR_ERR(dentry);
goto out_err;
goto out_putfd;
}
mntget(ipc_ns->mq_mnt);

Expand Down Expand Up @@ -742,7 +742,6 @@ SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, mode_t, mode,
mntput(ipc_ns->mq_mnt);
out_putfd:
put_unused_fd(fd);
out_err:
fd = error;
out_upsem:
mutex_unlock(&ipc_ns->mq_mnt->mnt_root->d_inode->i_mutex);
Expand Down

0 comments on commit 4294a8e

Please sign in to comment.