]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
if_ovpn: ensure we're in vnet context when calling sorele()
authorKristof Provost <kp@FreeBSD.org>
Thu, 10 Nov 2022 12:54:09 +0000 (13:54 +0100)
committerKristof Provost <kp@FreeBSD.org>
Mon, 14 Nov 2022 08:36:44 +0000 (09:36 +0100)
commit6905fd01cb64ca2853b8312880f18a6ae2068099
treeca507f831a3547fd2c40cbf8c3e9a11614228992
parent882fc6da1a5f810b18971329a31663498e61bbbf
if_ovpn: ensure we're in vnet context when calling sorele()

We reference count to ensure we don't release the socket while we still
have data in flight. That means that we can end up releasing the socket
from ovpn_encrypt_tx_cb().

We must have a vnet context set when calling sorele() (which asserts
this from within sofree()), so move the CURVNET_SET()/CURVNET_RESTORE()
to ensure this is the case.

While here also add a couple of assertions to make this more obvious,
and to ease future debugging.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D37326
sys/net/if_ovpn.c