From owner-svn-src-stable-8@FreeBSD.ORG Fri Sep 16 02:28:56 2011 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 022341065670; Fri, 16 Sep 2011 02:28:56 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CB93A8FC0C; Fri, 16 Sep 2011 02:28:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8G2StMb099844; Fri, 16 Sep 2011 02:28:55 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8G2Stnc099841; Fri, 16 Sep 2011 02:28:55 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109160228.p8G2Stnc099841@svn.freebsd.org> From: Adrian Chadd Date: Fri, 16 Sep 2011 02:28:55 +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: r225600 - in stable/8: share/man/man7 share/man/man9 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: Fri, 16 Sep 2011 02:28:56 -0000 Author: adrian Date: Fri Sep 16 02:28:55 2011 New Revision: 225600 URL: http://svn.freebsd.org/changeset/base/225600 Log: Merge r225570 from HEAD - Ensure that ta_pending doesn't overflow u_short by capping its value at USHRT_MAX. If it overflows before the taskqueue can run, the task will be re-added to the taskqueue and cause a loop in the task list. Submitted by: rstone@ Reviewed by: jhb@ MFC after: 1 day Modified: stable/8/share/man/man9/taskqueue.9 stable/8/sys/kern/subr_taskqueue.c Directory Properties: stable/8/share/man/ (props changed) stable/8/share/man/man1/ (props changed) stable/8/share/man/man3/ (props changed) stable/8/share/man/man4/ (props changed) stable/8/share/man/man5/ (props changed) stable/8/share/man/man7/ (props changed) stable/8/share/man/man7/ports.7 (props changed) stable/8/share/man/man8/ (props changed) stable/8/share/man/man9/ (props changed) 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/share/man/man9/taskqueue.9 ============================================================================== --- stable/8/share/man/man9/taskqueue.9 Thu Sep 15 22:50:31 2011 (r225599) +++ stable/8/share/man/man9/taskqueue.9 Fri Sep 16 02:28:55 2011 (r225600) @@ -124,7 +124,7 @@ If the task's .Va ta_pending field is non-zero, then it is simply incremented to reflect the number of times the task -was enqueued. +was enqueued, up to a cap of USHRT_MAX. Otherwise, the task is added to the list before the first task which has a lower .Va ta_priority Modified: stable/8/sys/kern/subr_taskqueue.c ============================================================================== --- stable/8/sys/kern/subr_taskqueue.c Thu Sep 15 22:50:31 2011 (r225599) +++ stable/8/sys/kern/subr_taskqueue.c Fri Sep 16 02:28:55 2011 (r225600) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -165,7 +166,8 @@ taskqueue_enqueue(struct taskqueue *queu * Count multiple enqueues. */ if (task->ta_pending) { - task->ta_pending++; + if (task->ta_pending < USHRT_MAX) + task->ta_pending++; TQ_UNLOCK(queue); return 0; }