Call ksem_get() with initialized 'rights'.

ksem_get() consumes fget(), and it's mandatory there.

Reported by:	truckman
Reviewed by:	mjg
This commit is contained in:
Sergey Kandaurov 2015-07-23 23:18:03 +00:00
parent fade8dd714
commit ef88ae77ea
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=285829

View File

@ -651,12 +651,13 @@ struct ksem_close_args {
int
sys_ksem_close(struct thread *td, struct ksem_close_args *uap)
{
cap_rights_t rights;
struct ksem *ks;
struct file *fp;
int error;
/* No capability rights required to close a semaphore. */
error = ksem_get(td, uap->id, 0, &fp);
error = ksem_get(td, uap->id, cap_rights_init(&rights), &fp);
if (error)
return (error);
ks = fp->f_data;
@ -872,12 +873,13 @@ struct ksem_destroy_args {
int
sys_ksem_destroy(struct thread *td, struct ksem_destroy_args *uap)
{
cap_rights_t rights;
struct file *fp;
struct ksem *ks;
int error;
/* No capability rights required to close a semaphore. */
error = ksem_get(td, uap->id, 0, &fp);
error = ksem_get(td, uap->id, cap_rights_init(&rights), &fp);
if (error)
return (error);
ks = fp->f_data;