Author: hselasky
Date: Mon Sep 21 18:24:28 2020
New Revision: 365963
URL: https://svnweb.freebsd.org/changeset/base/365963

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

Modified:
  stable/12/sys/kern/kern_timeout.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/kern_timeout.c
==============================================================================
--- stable/12/sys/kern/kern_timeout.c   Mon Sep 21 18:21:59 2020        
(r365962)
+++ stable/12/sys/kern/kern_timeout.c   Mon Sep 21 18:24:28 2020        
(r365963)
@@ -1382,6 +1382,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);
@@ -1390,6 +1393,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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to