From owner-svn-src-stable-8@FreeBSD.ORG Mon Dec 20 17:08:22 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 60D52106564A; Mon, 20 Dec 2010 17:08:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4F05B8FC08; Mon, 20 Dec 2010 17:08:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oBKH8Mi4068926; Mon, 20 Dec 2010 17:08:22 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oBKH8M9Q068924; Mon, 20 Dec 2010 17:08:22 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201012201708.oBKH8M9Q068924@svn.freebsd.org> From: John Baldwin Date: Mon, 20 Dec 2010 17:08:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r216593 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Dec 2010 17:08:22 -0000 Author: jhb Date: Mon Dec 20 17:08:22 2010 New Revision: 216593 URL: http://svn.freebsd.org/changeset/base/216593 Log: MFC 216504: 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. Approved by: re (kib) Modified: stable/8/sys/kern/kern_resource.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/kern/kern_resource.c ============================================================================== --- stable/8/sys/kern/kern_resource.c Mon Dec 20 16:39:43 2010 (r216592) +++ stable/8/sys/kern/kern_resource.c Mon Dec 20 17:08:22 2010 (r216593) @@ -472,29 +472,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);