diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c index c06e830fc1cb..5c364800f5a9 100644 --- a/sys/netgraph/ng_base.c +++ b/sys/netgraph/ng_base.c @@ -3624,13 +3624,18 @@ ng_untimeout(struct callout *c, node_p node) { item_p item; int rval; + void *c_func; if (c == NULL) return (0); - rval = callout_drain(c); + /* there must be an official way to do this */ + mtx_lock_spin(&callout_lock); + c_func = c->c_func; + rval = callout_stop(c); + mtx_unlock_spin(&callout_lock); item = c->c_arg; /* Do an extra check */ - if ((c->c_func == &ng_timeout_trapoline) && + if ((rval > 0) && (c_func == &ng_timeout_trapoline) && (NGI_NODE(item) == node)) { /* * We successfully removed it from the queue before it ran