[PATCH] sys_semop() EIDRM BUG fix

From: Hugh Dickins (hugh@veritas.com)
Date: Mon Feb 19 2001 - 11:39:45 EST


sys_semop() is wrong to insist that queue.status be -EIDRM when
sem_lock() fails on awakening. It is quite normal for update_queue()
to have set status 0, removed process from queue and woken it; but
IPC_RMID come in before that process gets to run (or to lock) -
since process already off queue, its status is not set to -EIDRM.
If we want a safety check here, check removed from queue instead.
Return original status or -EIDRM? Checked other OSes, use -EIDRM.

diff -urN linux-2.4.2-pre4/ipc/sem.c linux/ipc/sem.c
--- linux-2.4.2-pre4/ipc/sem.c Sat Feb 17 11:14:27 2001
+++ linux/ipc/sem.c Sun Feb 18 08:21:37 2001
@@ -922,7 +922,7 @@
 
                 tmp = sem_lock(semid);
                 if(tmp==NULL) {
- if(queue.status != -EIDRM)
+ if(queue.prev != NULL)
                                 BUG();
                         current->semsleeping = NULL;
                         error = -EIDRM;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Feb 23 2001 - 21:00:20 EST