summaryrefslogtreecommitdiff
path: root/ipc/msg.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-10-06 17:28:16 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-10-06 17:28:16 -0700
commit97a7729a5c2f01faa076f38a7ec010961b456823 (patch)
treed1aaecf81d1357b5920579347e6bb894b4bfe11c /ipc/msg.c
parent9987f76ad286887978803ece6cdcf34582279a29 (diff)
parentd0e639c9e06d44e713170031fe05fb60ebe680af (diff)
downloadlinux-97a7729a5c2f01faa076f38a7ec010961b456823.tar.gz
linux-97a7729a5c2f01faa076f38a7ec010961b456823.tar.xz
Merge 3.12-rc4 into tty-next
We want the tty fixes in this branch as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'ipc/msg.c')
-rw-r--r--ipc/msg.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/ipc/msg.c b/ipc/msg.c
index 9e4310c546ae..558aa91186b6 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -695,6 +695,12 @@ long do_msgsnd(int msqid, long mtype, void __user *mtext,
if (ipcperms(ns, &msq->q_perm, S_IWUGO))
goto out_unlock0;
+ /* raced with RMID? */
+ if (msq->q_perm.deleted) {
+ err = -EIDRM;
+ goto out_unlock0;
+ }
+
err = security_msg_queue_msgsnd(msq, msg, msgflg);
if (err)
goto out_unlock0;
@@ -901,6 +907,13 @@ long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp, int msgfl
goto out_unlock1;
ipc_lock_object(&msq->q_perm);
+
+ /* raced with RMID? */
+ if (msq->q_perm.deleted) {
+ msg = ERR_PTR(-EIDRM);
+ goto out_unlock0;
+ }
+
msg = find_msg(msq, &msgtyp, mode);
if (!IS_ERR(msg)) {
/*