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
This commit is contained in:
parent
fb0eeaae7f
commit
cbb41e7015
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user