Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipc: lost unlock and fput in mqueue.c on error path

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>

authored by

Pavel Emelyanov and committed by
Linus Torvalds
fd79b771 75d42798

+4 -2
+4 -2
ipc/mqueue.c
··· 1138 1138 omqstat.mq_flags = filp->f_flags & O_NONBLOCK; 1139 1139 if (u_mqstat) { 1140 1140 ret = audit_mq_getsetattr(mqdes, &mqstat); 1141 - if (ret != 0) 1142 - goto out; 1141 + if (ret != 0) { 1142 + spin_unlock(&info->lock); 1143 + goto out_fput; 1144 + } 1143 1145 if (mqstat.mq_flags & O_NONBLOCK) 1144 1146 filp->f_flags |= O_NONBLOCK; 1145 1147 else