if_wg: stop holding creds in wg_socket_init()

We're now xlocked when we create sockets, so we're now guaranteed that
the creds won't be released out from underneath us over in
wg_prison_remove().
This commit is contained in:
Kyle Evans 2021-03-15 01:21:25 -05:00
parent 1170485947
commit 99158c7fbd

View File

@ -953,9 +953,8 @@ wg_socket_init(struct wg_softc *sc, in_port_t port)
sx_assert(&sc->sc_lock, SX_XLOCKED);
td = curthread;
if (sc->sc_ucred == NULL)
if ((cred = sc->sc_ucred) == NULL)
return (EBUSY);
cred = crhold(sc->sc_ucred);
/*
* For socket creation, we use the creds of the thread that created the
@ -993,7 +992,6 @@ wg_socket_init(struct wg_softc *sc, in_port_t port)
wg_socket_set(sc, so4, so6);
}
out:
crfree(cred);
return (rc);
}