Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Sep 2011 02:28:55 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r225600 - in stable/8: share/man/man7 share/man/man9 sys/kern
Message-ID:  <201109160228.p8G2Stnc099841@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <sys/interrupt.h>
 #include <sys/kernel.h>
 #include <sys/kthread.h>
+#include <sys/limits.h>
 #include <sys/lock.h>
 #include <sys/malloc.h>
 #include <sys/mutex.h>
@@ -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;
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201109160228.p8G2Stnc099841>