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;
                        }
                }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to