X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=ipc%2Fsem.c;h=c8e00f8b4be1b79bd49bf841924d8d8ea5945b8c;hb=1850536b93888e6cc3ee42e63e20e61f35f8b3e2;hp=8b929e6a6eda22e96da29cb72423cdb06cef0685;hpb=8e204874db000928e37199c2db82b7eb8966cc3c;p=pandora-kernel.git diff --git a/ipc/sem.c b/ipc/sem.c index 8b929e6a6eda..c8e00f8b4be1 100644 --- a/ipc/sem.c +++ b/ipc/sem.c @@ -1450,15 +1450,24 @@ SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops, } sma = sem_lock(ns, semid); + + /* + * Wait until it's guaranteed that no wakeup_sem_queue_do() is ongoing. + */ + error = get_queue_result(&queue); + + /* + * Array removed? If yes, leave without sem_unlock(). + */ if (IS_ERR(sma)) { error = -EIDRM; goto out_free; } - error = get_queue_result(&queue); /* - * If queue.status != -EINTR we are woken up by another process + * If queue.status != -EINTR we are woken up by another process. + * Leave without unlink_queue(), but with sem_unlock(). */ if (error != -EINTR) {