svn commit: r225600 - in stable/8: share/man/man7 share/man/man9 sys/kern

Adrian Chadd adrian at
Fri Sep 16 02:28:56 UTC 2011

Author: adrian
Date: Fri Sep 16 02:28:55 2011
New Revision: 225600

  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

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.
 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++;
 		return 0;

More information about the svn-src-stable-8 mailing list