Skip to content

Commit

Permalink
ipc: lost unlock and fput in mqueue.c on error path
Browse files Browse the repository at this point in the history
The error path in sys_mq_getsetattr() after the call to
audit_mq_getsetattr() is wrong - the info->lock is not unlocked and the
struct file *filp is not put.

Fix them both.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Cc: Pierre Peiffer <pierre.peiffer@bull.net>
Cc: Nadia Derbey <Nadia.Derbey@bull.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Pavel Emelyanov authored and Linus Torvalds committed Nov 29, 2007
1 parent 75d4279 commit fd79b77
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ipc/mqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -1138,8 +1138,10 @@ asmlinkage long sys_mq_getsetattr(mqd_t mqdes,
omqstat.mq_flags = filp->f_flags & O_NONBLOCK;
if (u_mqstat) {
ret = audit_mq_getsetattr(mqdes, &mqstat);
if (ret != 0)
goto out;
if (ret != 0) {
spin_unlock(&info->lock);
goto out_fput;
}
if (mqstat.mq_flags & O_NONBLOCK)
filp->f_flags |= O_NONBLOCK;
else
Expand Down

0 comments on commit fd79b77

Please sign in to comment.