diff options
author | glebius <glebius@FreeBSD.org> | 2005-10-13 11:55:50 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2005-10-13 11:55:50 +0000 |
commit | 451af68b217c1cdd025909adeb0282fb6201fb41 (patch) | |
tree | ae26e70902f52c7826de4a8d7693893e23a7dd55 /sys/netgraph/ng_base.c | |
parent | e085cf5c30f71fc8321aa4c804d45119bcda1fad (diff) | |
download | FreeBSD-src-451af68b217c1cdd025909adeb0282fb6201fb41.zip FreeBSD-src-451af68b217c1cdd025909adeb0282fb6201fb41.tar.gz |
- When flushing node input queue, check whether item has a callback. If
it does, then call it suppling ENOENT as error value.
- Add assert, that helped to catch the above error.
Diffstat (limited to 'sys/netgraph/ng_base.c')
-rw-r--r-- | sys/netgraph/ng_base.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c index a86134e..3abd2ff 100644 --- a/sys/netgraph/ng_base.c +++ b/sys/netgraph/ng_base.c @@ -2067,6 +2067,10 @@ ng_flush_input_queue(struct ng_queue * ngq) atomic_add_long(&ngq->q_flags, add_arg); mtx_unlock_spin(&ngq->q_mtx); + if (item->apply != NULL) { + (item->apply)(item->context, ENOENT); + item->apply = NULL; + } NG_FREE_ITEM(item); mtx_lock_spin(&ngq->q_mtx); } @@ -2898,6 +2902,8 @@ ng_getqblk(int flags) void ng_free_item(item_p item) { + KASSERT(item->apply == NULL, ("%s: leaking apply callback", __func__)); + /* * The item may hold resources on it's own. We need to free * these before we can free the item. What they are depends upon |