Date: Fri, 17 Dec 2010 16:29:06 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r216504 - head/sys/kern Message-ID: <201012171629.oBHGT614087787@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Fri Dec 17 16:29:06 2010 New Revision: 216504 URL: http://svn.freebsd.org/changeset/base/216504 Log: Add back a bounds check on valid idle priorities that was lost in an earlier commit. While here, move the thread lock down in rtp_to_pri(). It is not needed for all of the priority value checks and the computation of newpri. Reported by: swell.k @ gmail MFC after: 3 days Modified: head/sys/kern/kern_resource.c Modified: head/sys/kern/kern_resource.c ============================================================================== --- head/sys/kern/kern_resource.c Fri Dec 17 16:21:30 2010 (r216503) +++ head/sys/kern/kern_resource.c Fri Dec 17 16:29:06 2010 (r216504) @@ -462,29 +462,27 @@ rtp_to_pri(struct rtprio *rtp, struct th u_char newpri; u_char oldpri; - thread_lock(td); switch (RTP_PRIO_BASE(rtp->type)) { case RTP_PRIO_REALTIME: - if (rtp->prio > RTP_PRIO_MAX) { - thread_unlock(td); + if (rtp->prio > RTP_PRIO_MAX) return (EINVAL); - } newpri = PRI_MIN_REALTIME + rtp->prio; break; case RTP_PRIO_NORMAL: - if (rtp->prio > (PRI_MAX_TIMESHARE - PRI_MIN_TIMESHARE)) { - thread_unlock(td); + if (rtp->prio > (PRI_MAX_TIMESHARE - PRI_MIN_TIMESHARE)) return (EINVAL); - } newpri = PRI_MIN_TIMESHARE + rtp->prio; break; case RTP_PRIO_IDLE: + if (rtp->prio > RTP_PRIO_MAX) + return (EINVAL); newpri = PRI_MIN_IDLE + rtp->prio; break; default: - thread_unlock(td); return (EINVAL); } + + thread_lock(td); sched_class(td, rtp->type); /* XXX fix */ oldpri = td->td_user_pri; sched_user_prio(td, newpri);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201012171629.oBHGT614087787>