mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-11-07 04:36:52 -10:00
libthr: reject count < 0
This causes count == -1 spin for INT_MAX times in userspace. Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D60425
This commit is contained in:
1 parent
1d21e67e72
commit
627e7d5b72
1 file changed
+4
@@ -1109,6 +1109,8 @@ __pthread_mutex_setspinloops_np(pthread_mutex_t *mutex, int count)
|
||||
struct pthread_mutex *m;
|
||||
int ret;
|
||||
|
||||
if (count < 0)
|
||||
return (EINVAL);
|
||||
ret = check_and_init_mutex(mutex, &m);
|
||||
if (ret == 0)
|
||||
m->m_spinloops = count;
|
||||
@@ -1133,6 +1135,8 @@ __pthread_mutex_setyieldloops_np(pthread_mutex_t *mutex, int count)
|
||||
struct pthread_mutex *m;
|
||||
int ret;
|
||||
|
||||
if (count < 0)
|
||||
return (EINVAL);
|
||||
ret = check_and_init_mutex(mutex, &m);
|
||||
if (ret == 0)
|
||||
m->m_yieldloops = count;
|
||||
|
||||
Reference in new issue
Block a user