diff options
-rw-r--r-- | ipc/sem.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -1450,15 +1450,24 @@ SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops, | |||
1450 | } | 1450 | } |
1451 | 1451 | ||
1452 | sma = sem_lock(ns, semid); | 1452 | sma = sem_lock(ns, semid); |
1453 | |||
1454 | /* | ||
1455 | * Wait until it's guaranteed that no wakeup_sem_queue_do() is ongoing. | ||
1456 | */ | ||
1457 | error = get_queue_result(&queue); | ||
1458 | |||
1459 | /* | ||
1460 | * Array removed? If yes, leave without sem_unlock(). | ||
1461 | */ | ||
1453 | if (IS_ERR(sma)) { | 1462 | if (IS_ERR(sma)) { |
1454 | error = -EIDRM; | 1463 | error = -EIDRM; |
1455 | goto out_free; | 1464 | goto out_free; |
1456 | } | 1465 | } |
1457 | 1466 | ||
1458 | error = get_queue_result(&queue); | ||
1459 | 1467 | ||
1460 | /* | 1468 | /* |
1461 | * If queue.status != -EINTR we are woken up by another process | 1469 | * If queue.status != -EINTR we are woken up by another process. |
1470 | * Leave without unlink_queue(), but with sem_unlock(). | ||
1462 | */ | 1471 | */ |
1463 | 1472 | ||
1464 | if (error != -EINTR) { | 1473 | if (error != -EINTR) { |