public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][IPC] Lost unlock and fput in mqueue.c on error path
@ 2007-11-21 13:54 Pavel Emelyanov
  0 siblings, 0 replies; only message in thread
From: Pavel Emelyanov @ 2007-11-21 13:54 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Kernel Mailing List, devel

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>

---

diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 0ce1ba6..7d1b8aa 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -1144,8 +1144,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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-11-21 13:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-21 13:54 [PATCH][IPC] Lost unlock and fput in mqueue.c on error path Pavel Emelyanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox