diff options
author | lstewart <lstewart@FreeBSD.org> | 2013-06-14 18:11:21 +0000 |
---|---|---|
committer | lstewart <lstewart@FreeBSD.org> | 2013-06-14 18:11:21 +0000 |
commit | cbb41e701531df6ae5e26b908d87c35895e7faea (patch) | |
tree | 9fee5696e0d11a6318bb1b687075c1676eeb00b3 | |
parent | fb0eeaae7fad8a76e0aa1584a4ae02a63bdc1e7f (diff) | |
download | FreeBSD-src-cbb41e701531df6ae5e26b908d87c35895e7faea.zip FreeBSD-src-cbb41e701531df6ae5e26b908d87c35895e7faea.tar.gz |
Fix a major oversight in r251732 which causes non-VIMAGE kernels to trigger a
KASSERT during TCP hhook registration at boot. Virtualised hook points only
require extra housekeeping and sanity checking when "options VIMAGE" is present.
Reported by: bdrewery,jh,dhw
Tested by: dhw
MFC after: 1 week
X-MFC with: 251732
-rw-r--r-- | sys/kern/kern_hhook.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/kern/kern_hhook.c b/sys/kern/kern_hhook.c index 6a417dc..63f09b2 100644 --- a/sys/kern/kern_hhook.c +++ b/sys/kern/kern_hhook.c @@ -267,9 +267,11 @@ hhook_head_register(int32_t hhook_type, int32_t hhook_id, struct hhook_head **hh HHHLIST_LOCK(); if (flags & HHOOK_HEADISINVNET) { tmphhh->hhh_flags |= HHH_ISINVNET; +#ifdef VIMAGE KASSERT(curvnet != NULL, ("curvnet is NULL")); tmphhh->hhh_vid = (uintptr_t)curvnet; LIST_INSERT_HEAD(&V_hhook_vhead_list, tmphhh, hhh_vnext); +#endif } LIST_INSERT_HEAD(&hhook_head_list, tmphhh, hhh_next); HHHLIST_UNLOCK(); @@ -285,8 +287,10 @@ hhook_head_destroy(struct hhook_head *hhh) HHHLIST_LOCK_ASSERT(); LIST_REMOVE(hhh, hhh_next); +#ifdef VIMAGE if (hhook_head_is_virtualised(hhh) == HHOOK_HEADISINVNET) LIST_REMOVE(hhh, hhh_vnext); +#endif HHH_WLOCK(hhh); STAILQ_FOREACH_SAFE(tmp, &hhh->hhh_hooks, hhk_next, tmp2) free(tmp, M_HHOOK); @@ -347,12 +351,14 @@ hhook_head_get(int32_t hhook_type, int32_t hhook_id) HHHLIST_LOCK(); LIST_FOREACH(hhh, &hhook_head_list, hhh_next) { if (hhh->hhh_type == hhook_type && hhh->hhh_id == hhook_id) { +#ifdef VIMAGE if (hhook_head_is_virtualised(hhh) == HHOOK_HEADISINVNET) { KASSERT(curvnet != NULL, ("curvnet is NULL")); if (hhh->hhh_vid != (uintptr_t)curvnet) continue; } +#endif refcount_acquire(&hhh->hhh_refcount); break; } |