Correct two incorrectly merged changes introduced in sysv_sem.c:1.71:

return EINVAL rather than setting error, and don't free sops
unconditionally.  The first change was merged accidentally as part of
the larger set of changes to introduce MAC labels and access control,
and potentially lead to continued processing of a request even after
it was determined to be invalid.  The second change was due to changes
in the semaphore code since the original work was performed.

Pointed out by:	truckman
This commit is contained in:
rwatson 2004-11-13 08:06:40 +00:00
parent 8c472001b2
commit 30050e8d88

View File

@ -901,7 +901,7 @@ semop(td, uap)
semid = IPCID_TO_IX(semid); /* Convert back to zero origin */
if (semid < 0 || semid >= seminfo.semmni)
error = EINVAL;
return (EINVAL);
/* Allocate memory for sem_ops */
if (nsops <= SMALL_SOPS)
@ -1153,7 +1153,6 @@ semop(td, uap)
mtx_unlock(sema_mtxp);
if (sops != small_sops)
free(sops, M_SEM);
free(sops, M_SEM);
return (error);
}