Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Sep 2020 10:00:31 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r365238 - head/sys/kern
Message-ID:  <202009021000.082A0VfB096870@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Wed Sep  2 10:00:30 2020
New Revision: 365238
URL: https://svnweb.freebsd.org/changeset/base/365238

Log:
  Assert that cc_exec_drain(cc, direct) is NULL before assigning a new value.
  
  Suggested by:	markj@
  Tested by:	callout_test
  MFC after:	1 week
  Sponsored by:	Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/kern/kern_timeout.c

Modified: head/sys/kern/kern_timeout.c
==============================================================================
--- head/sys/kern/kern_timeout.c	Wed Sep  2 09:44:00 2020	(r365237)
+++ head/sys/kern/kern_timeout.c	Wed Sep  2 10:00:30 2020	(r365238)
@@ -1269,6 +1269,9 @@ again:
 			CTR3(KTR_CALLOUT, "postponing stop %p func %p arg %p",
 			    c, c->c_func, c->c_arg);
  			if (drain) {
+				KASSERT(cc_exec_drain(cc, direct) == NULL,
+				    ("callout drain function already set to %p",
+				    cc_exec_drain(cc, direct)));
 				cc_exec_drain(cc, direct) = drain;
 			}
 			CC_UNLOCK(cc);
@@ -1277,6 +1280,9 @@ again:
 			CTR3(KTR_CALLOUT, "failed to stop %p func %p arg %p",
 			    c, c->c_func, c->c_arg);
 			if (drain) {
+				KASSERT(cc_exec_drain(cc, direct) == NULL,
+				    ("callout drain function already set to %p",
+				    cc_exec_drain(cc, direct)));
 				cc_exec_drain(cc, direct) = drain;
 			}
 		}



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