From: Pavel Emelyanov 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 Cc: Pierre Peiffer Cc: Nadia Derbey Signed-off-by: Andrew Morton --- ipc/mqueue.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff -puN ipc/mqueue.c~ipc-lost-unlock-and-fput-in-mqueuec-on-error-path ipc/mqueue.c --- a/ipc/mqueue.c~ipc-lost-unlock-and-fput-in-mqueuec-on-error-path +++ a/ipc/mqueue.c @@ -1138,8 +1138,10 @@ asmlinkage long sys_mq_getsetattr(mqd_t 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 _