Relock the sema_mtxp unconditionally after copyin() for SETALL case in
kern_semctl. Otherwise, later mtx_unlock() can operate on unlocked mutex. Submitted by: rdivacky MFC after: 3 days Approved by: re (kensmith)
This commit is contained in:
parent
95fb0fdd49
commit
e711aeee1e
@ -826,9 +826,9 @@ kern_semctl(struct thread *td, int semid, int semnum, int cmd,
|
||||
mtx_unlock(sema_mtxp);
|
||||
array = malloc(sizeof(*array) * count, M_TEMP, M_WAITOK);
|
||||
error = copyin(arg->array, array, count * sizeof(*array));
|
||||
mtx_lock(sema_mtxp);
|
||||
if (error)
|
||||
break;
|
||||
mtx_lock(sema_mtxp);
|
||||
if ((error = semvalid(semid, semakptr)) != 0)
|
||||
goto done2;
|
||||
KASSERT(count == semakptr->u.sem_nsems, ("nsems changed"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user