Skip to contentSkip to conversation

ipc/sem.c: scan complex wait-for-zero after undefined updates

PATCH New Manfred Spraul 1 participant 1 message Jun 15, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipc/sem.c: scan complex wait-for-zero after undefined updates

After an update of a semaphore array that does not use struct sembuf, complex wait-for-zero operations were not checked if they are able to proceed.

Andrew: Could you add it to -mm?
I've introduced the bug with
ipc-sem-separate-wait-for-zero-and-alter-tasks-into-seperate-queues.patch

---
 ipc/sem.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
ipc/sem.c +3 -1
index f9d1c06..ad9daca 100644
@@ -785,8 +785,10 @@ static int do_smart_wakeup_zero(struct sem_array *sma, struct sembuf *sops,
 		 * Assume all were changed.
 		 */
 		for (i = 0; i < sma->sem_nsems; i++) {
-			if (sma->sem_base[i].semval == 0)
+			if (sma->sem_base[i].semval == 0) {
+				got_zero = 1;
 				semop_completed |= wake_const_ops(sma, i, pt);
+			}
 		}
 	}
 	/*
Signature · 1 line
1.8.1.4