For transport mode, ipsec6_common_input_cb() releases the sahtree read
lock before it walks the remaining header chain. The error exits of
that walk jumped to the bad label, which released the lock a second
time. A packet that exceeds net.inet6.ip6.hdrnestlimit, is truncated,
or fails the inbound policy check on its last header is enough to get
there.
The second rm_runlock() panics kernels with INVARIANTS. Without
INVARIANTS it unbalances td_pinned and removes a tracker that is no
longer queued, which may corrupt the per-CPU tracker list.
Give the header chain walk its own exit label that skips the unlock.
Reported by: llm-postcr
Fixes: 183513d15f22 ("sys/netipsec: ensure sah stability during input callback processing")
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")