diff options
author | Ulrich Drepper <drepper@redhat.com> | 2009-04-23 02:29:18 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2009-04-23 02:29:18 +0000 |
commit | d301a6e167b75e6a6948d0de03ee44fd477fce56 (patch) | |
tree | 345dfaa352cd17275862f4e7f8f400aaa30cefda /nptl | |
parent | debafa10bcf2dd52392739a3aa6aff54f044fcd8 (diff) | |
download | glibc-d301a6e167b75e6a6948d0de03ee44fd477fce56.tar.gz glibc-d301a6e167b75e6a6948d0de03ee44fd477fce56.tar.xz glibc-d301a6e167b75e6a6948d0de03ee44fd477fce56.zip |
* pthread_attr_setschedparam.c (__pthread_attr_setschedparam):
Check policy and priority for validity. Patch mostly by Zhang Xiliang <zhangxiliang@cn.fujitsu.com>.
Diffstat (limited to 'nptl')
-rw-r--r-- | nptl/ChangeLog | 6 | ||||
-rw-r--r-- | nptl/pthread_attr_setschedparam.c | 8 |
2 files changed, 13 insertions, 1 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 049d3ce395..e5fab66e64 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,9 @@ +2009-04-22 Ulrich Drepper <drepper@redhat.com> + + * pthread_attr_setschedparam.c (__pthread_attr_setschedparam): + Check policy and priority for validity. + Patch mostly by Zhang Xiliang <zhangxiliang@cn.fujitsu.com>. + 2009-03-15 Ulrich Drepper <drepper@redhat.com> * sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S diff --git a/nptl/pthread_attr_setschedparam.c b/nptl/pthread_attr_setschedparam.c index 976ad13873..b4d4bbe055 100644 --- a/nptl/pthread_attr_setschedparam.c +++ b/nptl/pthread_attr_setschedparam.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2004, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -31,6 +31,12 @@ __pthread_attr_setschedparam (attr, param) assert (sizeof (*attr) >= sizeof (struct pthread_attr)); struct pthread_attr *iattr = (struct pthread_attr *) attr; + int min = sched_get_priority_min (iattr->schedpolicy); + int max = sched_get_priority_max (iattr->schedpolicy); + if (min == -1 || max == -1 + || param->sched_priority > max || param->sched_priority < min) + return EINVAL; + /* Copy the new values. */ memcpy (&iattr->schedparam, param, sizeof (struct sched_param)); |