The branch main has been updated by kevans:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=99158c7fbd565e0898ee31f47bbdf091e0c853d8

commit 99158c7fbd565e0898ee31f47bbdf091e0c853d8
Author:     Kyle Evans <kev...@freebsd.org>
AuthorDate: 2021-03-15 06:21:25 +0000
Commit:     Kyle Evans <kev...@freebsd.org>
CommitDate: 2021-03-15 06:21:25 +0000

    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().
---
 sys/dev/if_wg/if_wg.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sys/dev/if_wg/if_wg.c b/sys/dev/if_wg/if_wg.c
index c0b3ecdaa002..4d5c66133a8f 100644
--- a/sys/dev/if_wg/if_wg.c
+++ b/sys/dev/if_wg/if_wg.c
@@ -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);
 }
 
_______________________________________________
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"

Reply via email to