ipc,sem: fine grained locking for semtimedop
[linux-2.6-block.git] / ipc / msg.c
index a80aaf463d9c34a72fd6f649fdab88c3c0abb972..09a1f41e6595f9198f1a25d55f5d5c00f1f154b9 100644 (file)
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -687,7 +687,12 @@ long do_msgsnd(int msqid, long mtype, void __user *mtext,
                        goto out_unlock_free;
                }
                ss_add(msq, &s);
-               ipc_rcu_getref(msq);
+
+               if (!ipc_rcu_getref(msq)) {
+                       err = -EIDRM;
+                       goto out_unlock_free;
+               }
+
                msg_unlock(msq);
                schedule();